Simple question, update()

Hi,
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!
error0.png
error1.PNG
C0RNELAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

bindingnavagator1.update.click

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.
0
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
0
Gagan_JauraCommented:
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.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
OWASP Proactive Controls

Learn the most important control and control categories that every architect and developer should include in their projects.

Gagan_JauraCommented:
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.
0
Gagan_JauraCommented:
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
_settingsTableTableAdapter.Update(settingDataSet11.Tables[0]);

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

thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.