Simple question, update()

I am learning VS and C# so kindly excuse me if this is too simple or silly... but i am a newbie tthis.

I am basically trying to update my database table (called _SettingsTable, which has just 3 fields: WelcomeText(char),SplashPicture(char) and SplashDisabled(int)) with some values, but I dont think I am using the Update() method properly, it keeps asking me to make a datarow.. which i have no idea how to do.

Below is the code and the error I am getting as well.

Thanks in advance!
Who is Participating?
Gagan_JauraConnect With a Mentor Commented:
Go to edit dataset with designer (you can go there from the "Data" menu then "show data sources" and "Edit dataset with designer".

Right click the adapter and select "Configure". Click "Advanced options". Make sure the "Refresh the data table" is selected. Click OK and Finish.

Tell me if it works. Good luck.
Justin MaloneSystem AdministratorCommented:
when dealing with this situation i like to just cheet. go to the tools box then go to data and add a bindingnavagator then choose to hide the bar and whenever you want to update your code would then be

the navagator includes a button to save just add the bar, hide it, then use the name of the button with a .click at the end of it wherever you want to add update code in your program.
C0RNELAuthor Commented:
Theres a small problem with that, if you look at the checkbox code, i am saving it as a 0 or 1, for checked and not checked state... so there is a kind of "conversion" code in the middle... i dont think the update from the binding navigator wold work in this situation
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Here's what I found that should resolve your problem...

When working with the Wizards and Designers in Visual Studio the code generators building the UPDATE statement need a few essentials to build the code:

1. A table. Not a product of a JOIN or a table that includes an expression--just a table.
2.A primary key or unique column on the table. Converting from an Access database does not usually bring over the PK which is needed to construct the WHERE clause to point to the row to change.
3.The column names can't contain special characters.
4.The columns can't "participate" in Foreign Key constraints.
See ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.VisualStudio.v80.en/WD_ADONET/html/6e3fb8b5-373b-4f9e-ab03-a22693df8e91.htm for more information.
You can also try the below solution
Dim myBuilder As SqlCommandBuilder = New SqlCommandBuilder(_settingsTableTableAdapter)
SqlCommandBuilder myBuilder = new SqlCommandBuilder(_settingsTableTableAdapter);
_settingsTableTableAdapter.UpdateCommand = myBuilder.GetUpdateCommand();
_settingsTableTableAdapter.Update(settingDataSet11); or

C0RNELAuthor Commented:
> Dim myBuilder As SqlCommandBuilder = New SqlCommandBuilder(_settingsTableTableAdapter
I am using c#, i think you gave me the code for VB?
C0RNELAuthor Commented:
Your solution by itself didnt solve it, but it helped me find the answer :)

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.