Page 1 of 1

error when trying to write to the database

Posted: Tue 09 Nov 2004 19:35
by ddepuemd
i keep getting this error:

Commands out of sync; You can't run this command now

does anyone know what this is???

I need to get this going soon!

Thanks,
Dean

error

Posted: Tue 09 Nov 2004 19:38
by ddepuemd
by the way, this is my simple commands:

Dim sql As String
sql = "update set = 1"
Dim mysql As New CoreLab.MySql.MySqlCommand
mysql.CommandText = sql
mysql.Connection = connection
mysql.Connection.Open()
mysql.ExecuteNonQuery()
connection.Close()

connection works, which is just the string to connect. it fails on the executenonquery statement no matter how I construct the sql.

HELP!

Re: error when trying to write to the database

Posted: Wed 10 Nov 2004 08:22
by Oleg
This exception raises if you have open DataReader constrained with the connection. Make sure that you always close DataReader in your code. Use Try - Finally clause for closing your DataReader objects.