[ODBC] Zugriff auf SQL Server

using System.Data;
using System.Data.Odbc;

// Username
string sUID = @"user";
// Passwort
string sPW = @"password";
// Server
string sServer = @"127.0.0.1";
// Database
string sDB = @"DatabaseName";
// SQL-String
string sSql = @"SELECT Names FROM MyTable";

OdbcConnection conn = null;
OdbcDataReader reader = null;

try
{
    // Verbindung herstellen
    conn = new OdbcConnection("Driver={SQL Server};Server=" + sServer + ";UID=" + sUID + ";PWD=" + sPW + ";Database=" + sDB + ";");
    conn.Open();

    // SQL-Kommando abschicken
    OdbcCommand cmd = new OdbcCommand(sSql, conn);
    reader = cmd.ExecuteReader();

    // Daten auslesen und anzeigen
    while (reader.Read())
    {
        Console.WriteLine(reader["Names"]);
    }
}
catch (Exception ex)
{
    Console.WriteLine("Error: " + ex);
}
finally
{
    // aufräumen
    if (reader != null) reader.Close();
    if (conn != null) conn.Close();
}