Read MySQL
This. TMr. Enabled = false;
If (Conn! = NULL)
Conn. Close ();
String connstr = string. Format ("Server = {0}; user id = {1}; Password = {2 };
Database = test; pooling = false ",
"Localhost", "root", "root ");
Try
{
Conn = new mysqlconnection (connstr );
Conn. open ();
}
Catch (mysqlexception ex)
{
MessageBox. Show ("error connecting to the server:" + ex. Message );
}
// Data = new datatable ();
// Da = new mysqldataadapter ("select * from user", Conn );
// Cb = new mysqlcommandbuilder (DA );
// Da. Fill (data );
// DataGrid. datasource = data;
// Conn. Close ();
Mysqlcommand mycmd = new mysqlcommand ("select * from user", Conn );
Mysqldatareader myreader = mycmd. executereader ();
While (myreader. Read ())
{
If (myreader. hasrows)
{
Console. writeline (myreader. getstring ("ID "));
// Response. Write (myreader. getstring ("email") + "Br /");
}
}
Myreader. Close ();
Conn. Close ();