|
-
Aug 21st, 2007, 07:44 AM
#1
Thread Starter
Fanatic Member
[2.0] Update Sql Database
I have a form and on the form are basically a bunch of textboxes. I dropped a sqldataadapter on the form and connected to my data. It created a binding source and my controls are all bound to it. When I start the form I get my first record and I can navigate throughout the database. When I make a change, it is stored in my dataset but that does not update the sql server. When I close the form and reopen, all my changes are gone. Where should I be updating the database (as I navigate, each record or when closing the form), and how?
-
Aug 21st, 2007, 07:47 AM
#2
Thread Starter
Fanatic Member
Re: [2.0] Update Sql Database
WOW, I found it and it was fairly simple. I just added this on form closing. but is this the normal way to do it? ds7281 is my dataset.
CODE] string strAnswer;
strAnswer = Convert.ToString(MessageBox.Show("Do you wish to save your changes?", "Save Changes", MessageBoxButtons.YesNo));
if (strAnswer == "Yes")
{
sqlDataAdapter1.Update(ds7281);
}[/CODE]
-
Aug 21st, 2007, 07:02 PM
#3
Re: [2.0] Update Sql Database
That is exactly how it's supposed to be done and is exactly what a DataAdapter is for.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|