Now add the following lines of code to connect it to the DataBase.
string sConString = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost;DATABASE=Lakhan; UID=root; PASSWORD=; OPTION=3";This piece of code will return a DataSet that contains data from tdTest Table.
OdbcConnection oConnection = new OdbcConnection(sConString);
string sSQL = "SELECT * FROM tdTest";
OdbcDataAdapter oDataAdapter = new OdbcDataAdapter(sSQL, oConnection);
DataSet oDataSet = new DataSet();
oDataAdapter.Fill(oDataSet);
0 comments:
Post a Comment