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

How to Write Data from dataset back to Database?

P: n/a
Hello NG,

i have have the following problem:

Im updating a Dataset like this:

Dim winsortDs As New DataSet()
Dim winsortDa As New SqlDataAdapter("SELECT * FROM barcodeClasses",
getActiveConnection())

For i = 0 To svrBarcodeClasses.Rows().Count - 1
winsortDs.Tables(0).ImportRow(svrBarcodeClasses.Ro ws(i))
Next
'after that, i show for Debugpurposes the recordcount in a textbox:

UpdateForm.txtDebug2.Text += winsortDs.Tables(0).Rows.Count.ToString
'The correct recordCount is shown.
'Then i do the following:

winsortDs.AcceptChanges()
winsortDa.Update(winsortDs)

'When i take a look in the database, i see that there happens nothing.
'The program does not throw any exception, it seems to work fine.

I wonder why does the dataset not update the SQL-Database?
Have someone any ideas?

Thanks in advanced,
Ralf
Jul 24 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Ralf,

You might try it without the AcceptChanges.

Kerry Moorman

"news.microsoft.com" wrote:
Hello NG,

i have have the following problem:

Im updating a Dataset like this:

Dim winsortDs As New DataSet()
Dim winsortDa As New SqlDataAdapter("SELECT * FROM barcodeClasses",
getActiveConnection())

For i = 0 To svrBarcodeClasses.Rows().Count - 1
winsortDs.Tables(0).ImportRow(svrBarcodeClasses.Ro ws(i))
Next
'after that, i show for Debugpurposes the recordcount in a textbox:

UpdateForm.txtDebug2.Text += winsortDs.Tables(0).Rows.Count.ToString
'The correct recordCount is shown.
'Then i do the following:

winsortDs.AcceptChanges()
winsortDa.Update(winsortDs)

'When i take a look in the database, i see that there happens nothing.
'The program does not throw any exception, it seems to work fine.

I wonder why does the dataset not update the SQL-Database?
Have someone any ideas?

Thanks in advanced,
Ralf
Jul 24 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.