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

Update table SQL Express & VS 2005

P: n/a
OK, I hate myself for asking this, it's the worst question I have ever asked
but it's worse not to ask:

┬┐How do I update a datatable in vs 2005? I mean, I am using a typed dataset,
a datagridview control and SQL express. I tried this code on a separate
button to commit changes to the database:

Private Sub cmdOK_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdOK.Click
If Not Me.DataSet.DataTable.GetChanges Is Nothing Then
Me.DataTableTableAdapter.Update(Me.DataSet.DataTab le.GetChanges)
End If
End Sub

It seems to work fine, no exception is thrown, the update method returns 1,
the datagridview shows just the right modified data, and if I clear the
dataset and fill it again with the tableadapter it keeps the same data. But
it's not working, when I open this SQL Express datatable from the visual
studio server explorer it has the original unedited data and I can't change
that.

I have event tried to run a simple sqlcommand with an insert query, but I
get the same results. Am I doing anything wrong? Maybe I must configure
something on SQL Express or in VS? Call some method of the dataset, the
tableadapter, the bindingsource or the datagridview before changes can be
sent to the database?

Just to add some more info, I tried to update, insert and delete data from
the Server Explorer and it works fine.
Jan 3 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi,

"Joaquin" <Jo*****@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
OK, I hate myself for asking this, it's the worst question I have ever
asked
but it's worse not to ask:

┐How do I update a datatable in vs 2005? I mean, I am using a typed
dataset,
a datagridview control and SQL express. I tried this code on a separate
button to commit changes to the database:

Private Sub cmdOK_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdOK.Click
If Not Me.DataSet.DataTable.GetChanges Is Nothing Then
Me.DataTableTableAdapter.Update(Me.DataSet.DataTab le.GetChanges)
End If
End Sub

It seems to work fine, no exception is thrown, the update method returns
1,
the datagridview shows just the right modified data, and if I clear the
dataset and fill it again with the tableadapter it keeps the same data.
But
it's not working, when I open this SQL Express datatable from the visual
studio server explorer it has the original unedited data and I can't
change
that.
Maybe this can help you:
http://tinyurl.com/c3lvw

Greetings


I have event tried to run a simple sqlcommand with an insert query, but I
get the same results. Am I doing anything wrong? Maybe I must configure
something on SQL Express or in VS? Call some method of the dataset, the
tableadapter, the bindingsource or the datagridview before changes can be
sent to the database?

Just to add some more info, I tried to update, insert and delete data from
the Server Explorer and it works fine.

Jan 3 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.