Simple Database Access

string connectionString = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=test;USER=root;PASSWORD=mypassword;OPTION=3;";
IDbConnection conn = new OdbcConnection(connectionString);
IDbCommand command = new OdbcCommand("select UserID, FirstName from Users");
command.Connection = conn;
IDataReader reader = command.ExecuteReader();
while (reader.Read())
	string userID = (string) reader["UserID"];
	string firstName = (string) reader["FirstName"];

You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

AddThis Social Bookmark Button

Similar Posts

Comments are closed.