if you decide to use the mysql connector-net there's a chance I can guide otherwise you have to wait for someone else to help you :p
Printable View
if you decide to use the mysql connector-net there's a chance I can guide otherwise you have to wait for someone else to help you :p
I changed it to mysql-connector-net I don't have the previous error but a new one when I copy and paste the first code you gave, I get the following errors:
the name 'cmd' does not exist in the current context
oops, sorry, I forgot to copy one more line last time, here's my test class again:
this is only a sample so there is no try/catch and your app will crash if an error occursCode:class MySqlTest
{
public static void RunTest()
{
MySqlConnection conn = new MySqlConnection("server=localhost;uid=csharp;pwd=csharp;database=csharptest;charset=utf8");
conn.Open();
MySqlCommand cmd = new MySqlCommand();
cmd.Connection = conn;
cmd.CommandText = "SELECT * FROM someTable";
MySqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
Debug.WriteLine(reader[0] + " -- " + reader[1]); // 0 and 1 because I've got two collumns in my test table
}
reader.Close();
conn.Close();
reader.Dispose();
conn.Dispose();
}
}
it seems to have no errors given. If I put the connection code on the form load section. Is it global? And how do I close connection at the end of the program? (asking too much :))
thanks ;)