Click here to Skip to main content
15,890,282 members
Home / Discussions / C#
   

C#

 
GeneralRe: xml Pin
Nick Parker30-Jun-04 18:15
protectorNick Parker30-Jun-04 18:15 
GeneralCheckedListBox Pin
ahmed mohamed abdelhameed30-Jun-04 16:13
ahmed mohamed abdelhameed30-Jun-04 16:13 
GeneralRe: CheckedListBox Pin
saud_a_k30-Jun-04 23:39
saud_a_k30-Jun-04 23:39 
GeneralRe: CheckedListBox Pin
Robert Rohde1-Jul-04 19:26
Robert Rohde1-Jul-04 19:26 
GeneralUpdating access file Pin
benglish7230-Jun-04 15:22
benglish7230-Jun-04 15:22 
GeneralRe: Updating access file Pin
cmarmr30-Jun-04 17:05
cmarmr30-Jun-04 17:05 
GeneralRe: Updating access file Pin
benglish7230-Jun-04 18:03
benglish7230-Jun-04 18:03 
GeneralRe: Updating access file Pin
Heath Stewart30-Jun-04 18:17
protectorHeath Stewart30-Jun-04 18:17 
There's many things wrong with this code. First of all - don't open and close the connection yourself (especially while editing the DataSet - it's a disconnected recordset to no connection is needed; this is not ADO); the OleDbDataAdapter opens and closes the connection reliably.

Second, OleDbDataAdapter.Update will call DataSet.AcceptChanges() internally - you do not need to call this yourself.

Third, as the other poster said, in order to update your database with the changed data in a DataSet, you need to have the corresponding properties of an OleDbDataAdapter - UpdateCommand, InsertCommand, and DeleteCommand - assigned appropriately. So, if you have records that have been changed, the UpdateCommand is needed. If the DataSet ultimately contains rows that were added or deleted, you need the InsertCommand and DeleteCommand properties assigned, respectively. For simple queries (whatever is assigned to the SelectCommand) you can use the OleDbCommandBuilder as the other poster said. How do you expect the OleDbDataAdapter to update the database if it doesn't know how to update the database?

 

Microsoft MVP, Visual C#
My Articles
Generallaunch batch file Pin
Rob Tomson30-Jun-04 14:30
Rob Tomson30-Jun-04 14:30 
GeneralRe: launch batch file Pin
Anders Molin30-Jun-04 14:58
professionalAnders Molin30-Jun-04 14:58 
GeneralRe: launch batch file Pin
Heath Stewart30-Jun-04 18:20
protectorHeath Stewart30-Jun-04 18:20 
GeneralDrawing Rectangles on top of multiple controls Pin
theoutlander30-Jun-04 11:28
theoutlander30-Jun-04 11:28 
GeneralStreaming Audio Pin
Grimolfr30-Jun-04 9:39
Grimolfr30-Jun-04 9:39 
Questionwill there be a Standard Edition? Pin
SJ_Phoenix30-Jun-04 9:26
SJ_Phoenix30-Jun-04 9:26 
AnswerRe: will there be a Standard Edition? Pin
Judah Gabriel Himango30-Jun-04 9:58
sponsorJudah Gabriel Himango30-Jun-04 9:58 
GeneralRe: will there be a Standard Edition? Pin
Heath Stewart30-Jun-04 18:23
protectorHeath Stewart30-Jun-04 18:23 
GeneralCalling Java from C# Pin
BrcKcc30-Jun-04 9:14
BrcKcc30-Jun-04 9:14 
GeneralRe: Calling Java from C# Pin
Judah Gabriel Himango30-Jun-04 10:06
sponsorJudah Gabriel Himango30-Jun-04 10:06 
GeneralRe: Calling Java from C# Pin
Heath Stewart30-Jun-04 18:30
protectorHeath Stewart30-Jun-04 18:30 
Questionjavadoc-style document generator for .NET? Pin
drizzay30-Jun-04 8:43
drizzay30-Jun-04 8:43 
AnswerRe: javadoc-style document generator for .NET? Pin
Heath Stewart30-Jun-04 8:50
protectorHeath Stewart30-Jun-04 8:50 
GeneralRe: javadoc-style document generator for .NET? Pin
steven shingler30-Jun-04 12:30
steven shingler30-Jun-04 12:30 
Generalerror could not access cdo.message Pin
VIJAYPAPUPAGER30-Jun-04 8:28
VIJAYPAPUPAGER30-Jun-04 8:28 
GeneralRe: error could not access cdo.message Pin
Nick Parker30-Jun-04 8:36
protectorNick Parker30-Jun-04 8:36 
Generalmultiple splitting Pin
blankg30-Jun-04 8:21
blankg30-Jun-04 8:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.