Error message while connecting to mysql

gp04lch

New member
Joined
Sep 28, 2006
Messages
1
Programming Experience
Beginner
hi guys, i'm new to ado.net and i tried the following codes out:myconnection = New MySqlConnection("server=127.0.0.1;uid=root;pwd=password;database=digitech")mysqldataadapter = New MySqlDataAdapter("SELECT * FROM tester", myconnection)Dim mydataset As DataSet = New DataSet()Dim mydatarow As DataRowDim mydatarowscommandbuilder As MySqlCommandBuilder = New MySqlCommandBuilder(mysqldataadapter)mysqldataadapter.MissingSchemaAction = MissingSchemaAction.Addmysqldataadapter.Fill(mydataset, "tester")mydatarow = mydataset.Tables("tester").NewRow()mydatarow("Name") = "NewName"mydatarow("Address") = "Address"mydatarow("Telephone") = "016-1111111"mydataset.Tables("tester").Rows.Add(mydatarow)mysqldataadapter.Update(mydataset, "tester")my main concern is to be able to update the database successfully. however when i run the following codes it gives me an error: 'Connection must be valid and open'where did i go wrong? regards, jonathan
 
sorry mate i cant help you, i havent done mysql. but bloody well mate make your posts readable!!!!

people will be able to help you alot easier if they can read your post with ease.

good luck

regards
adam
 
aiee... look at your post! can you read it?

If you need some help getting your code to appear properly here, feel free to ask; it will increase your chance of someone actually looking at your post deeply..


@Gruntiee:
Youre right, but I wish to be a little more precise:
You need to ensure the connection is open before you attempt to Execute the query.. It doesnt exactly have to be open before passing to the DA, but it does need to be opened at some point before running the query. Doing it before you pass it to the DA is as good a place as any to do it, however..
 
Back
Top