By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,534 Members | 974 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,534 IT Pros & Developers. It's quick & easy.

Adapter.Update()

P: n/a
I'm tring to update my Table which haven't a primary key from a DataGrid but
I'm having the following error"Dynamic SQL generation for the UpdateCommand
is not supported against a SelectCommand that does not return any key column
information."
this the code that I'm using:

Dim cmd As New OleDbCommand("select * from Choices where ID =2", cn)
Dim adapter As New OleDbDataAdapter(cmd)
Dim cmb As New OleDbCommandBuilder(adapter)
adapter.Fill(ds)
grdQuestions.DataSource = ds.Tables(0)
adapter.Update(ds)

where could be the problem!!?
Thnks
--
Regads,
Rochdi
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
John,

You can start to tell to the dataadapter to use addwithkey

http://msdn.microsoft.com/library/de...classtopic.asp

I hope this helps,

Cor

"John" <Jo**@discussions.microsoft.com> schreef in bericht
news:59**********************************@microsof t.com...
I'm tring to update my Table which haven't a primary key from a DataGrid
but
I'm having the following error"Dynamic SQL generation for the
UpdateCommand
is not supported against a SelectCommand that does not return any key
column
information."
this the code that I'm using:

Dim cmd As New OleDbCommand("select * from Choices where ID =2", cn)
Dim adapter As New OleDbDataAdapter(cmd)
Dim cmb As New OleDbCommandBuilder(adapter)
adapter.Fill(ds)
grdQuestions.DataSource = ds.Tables(0)
adapter.Update(ds)

where could be the problem!!?
Thnks
--
Regads,
Rochdi

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.