logo       

DeleteCommand Problem: msg#00131

db.mysql.windows

Subject: DeleteCommand Problem

I am new to VB .Net and mySql and cannot find a solution to this problem in
my texts or in the archives.



I am connecting to my database ok, but when I add a DeleteCommand built by
cmdBuilder or built manually by me, I get this error that says my
SelectCommand does not return any key column information. I don?t
understand because my Select command is SELECT * FROM names. I also added
da.FillSchema thinking this might bring additional info but it didn?t help.
Anyone know whats going on here?

ERROR Message:
An unhandled exception of type 'System.InvalidOperationException' occurred
in system.data.dll

Additional information: Dynamic SQL generation for the DeleteCommand is not
supported against a SelectCommand that does not return any key column
information.


CODE:
Dim MyConString As String
Dim myConnection As OdbcConnection
MyConString = "Driver={MySQL ODBC 3.51
Driver};server=localhost;database=people;" & _
"UID=root"
myConnection = New OdbcConnection(MyConString)
Dim ds As New DataSet()
' retrieve a record from a table
Dim sql As String = "SELECT * FROM names"
Dim da As New OdbcDataAdapter(sql, myConnection)
da.FillSchema(ds, SchemaType.Source, "Names")
da.Fill(ds, "Names")
dgNames.SetDataBinding(ds, "Names")
Dim cmdBuilder As New OdbcCommandBuilder(da)
' use it to build the Command objects
da.InsertCommand = cmdBuilder.GetInsertCommand
da.DeleteCommand = cmdBuilder.GetDeleteCommand ç error occurs here
da.UpdateCommand = cmdBuilder.GetUpdateCommand






---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html"; before
posting. To request this thread, e-mail win32-thread10600@xxxxxxxxxxxxxxx

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail win32-unsubscribe@xxxxxxxxxxxxxxx instead.




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise