The variable gets dimmed but not used?
Main Topics
Browse All TopicsHi,
I added a datasource to my project and in turn it added a bindingnavigator, bindingsource and table adapter to my form. This all seems to work fine; however, when I hit save on the bindingnavigator I get the following error:
Update requires a valid UpdateCommand when passed DataRow collection with modified rows.
The code, generated by Visual Studio when I added the data source, is:
Me.Validate()
Me.BOM_ENTRYBindingSource.
Me.BOM_ENTRYTableAdapter.U
All of the posts I have found refer to adding additional code before the update. Because the code was generated by VS, I didn't want to mess something up be changing it. Any ideas?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Have you tried ?
It build the transact commands to the datadapter.
http://msdn.microsoft.com/
>> I assume that it recognizes the key from the SQL Server or do I need to specify somewhere on the Visual Studio side what the master key is?
Yes.
Try one more thing: goto the dataset you are using and right click on the table and choose configure. Then in the advanced option check the the "Generate Insert, Update and Delete statements" are checked.
In the code you show in your first post, right click on the word Update in BOM_ENTRYTableAdapter.Upda
>>
<System.Diagnostics.Debugge
System.ComponentModel.Desi
Public Overloads Overridable Function Update(ByVal dataTable As dsMainCust.MainCustDataTab
Return Me.Adapter.Update(dataTabl
End Function
<<
In that, right click on the word Adapter and again select "Go To Definition". That should take you to something like this
>>
<System.Diagnostics.Debugge
Private ReadOnly Property Adapter() As System.Data.SqlClient.SqlD
Get
If (Me._adapter Is Nothing) Then
Me.InitAdapter
End If
Return Me._adapter
End Get
End Property
<<
In that, right click on InitAdapter and again select "Go To Definition". In the code that then appears, is there a line starting like this
>>
Me._adapter.UpdateCommand.
<<
Once we know that, we'll have a better idea of where to look for the problem.
Roger
Sorry for the long delay - I was travelling today.
When I click on go to definition from Update in:
Me.BOM_ENTRYTableAdapter.U
I get:
<Global.System.Diagnostics.
Global.System.ComponentMod
Public Overloads Overridable Function Update(ByVal dataTable As dsBOM_ENTRY.BOM_ENTRYDataT
Return Me.Adapter.Update(dataTabl
End Function
From the word adapter I get:
<Global.System.Diagnostics.
Private ReadOnly Property Adapter() As Global.System.Data.SqlClie
Get
If (Me._adapter Is Nothing) Then
Me.InitAdapter
End If
Return Me._adapter
End Get
End Property
I think we have gotten to the issue. I don't have the line Me._adapter.UpdateCommand.
Business Accounts
Answer for Membership
by: jpaulinoPosted on 2008-07-26 at 17:30:01ID: 22096743
Try to do this way:
Select allOpen in new window