Click here to Skip to main content
15,902,112 members
Home / Discussions / C#
   

C#

 
GeneralRe: create a Byte[] array Pin
Sasuko6-Feb-05 1:27
Sasuko6-Feb-05 1:27 
Generalremote user name Pin
Opa Knack6-Feb-05 0:12
Opa Knack6-Feb-05 0:12 
GeneralRe: remote user name Pin
Heath Stewart6-Feb-05 7:21
protectorHeath Stewart6-Feb-05 7:21 
QuestionCreating MMC snap-in? Pin
esjq5-Feb-05 23:33
esjq5-Feb-05 23:33 
AnswerRe: Creating MMC snap-in? Pin
Heath Stewart6-Feb-05 7:18
protectorHeath Stewart6-Feb-05 7:18 
GeneralRe: Creating MMC snap-in? Pin
esjq6-Feb-05 20:53
esjq6-Feb-05 20:53 
Generalupdate doesn't update database Pin
xrado5-Feb-05 23:14
xrado5-Feb-05 23:14 
GeneralRe: update doesn't update database Pin
Heath Stewart6-Feb-05 7:10
protectorHeath Stewart6-Feb-05 7:10 
IMO, to call an OdbcDataAdapter instance myCommand is confusing. You should - following suggested naming guidelines in the .NET Framework sDK - use myAdapter at the very least. Something even more descriptive than that, using "adapter" somewhere, would even be better.

Also, while not the problem, calling ds.AcceptChanges() is not necessary. The Update method does this for you upon successful completion of updating the data store (i.e., no exceptions are thrown).

You should try debugging the code to make sure that the OdbcCommandBuilder constructed suitable SQL statements for each of OdbcDataAdapter's properties besides the SelectCommand which you've already defined (and is required for the command builder).

Are you sure that the DataSet is full and that all the data is in the "novice" DataTable? At times you have to set up OdbcDataAdapter.TableMappings if the table from which you're selecting doesn't result in the table name you expect. This is a problem with SQL Server, which names it's tables (result sets) "Table", "Table1", "Table2", and so on.

I also assume that the BindingContext code is elsewhere, perhaps as part of a Button.Click handler? Make sure that however you bind your data, you use the same exact approach to get the BindingContext. To eliminate any problems, it's recommended that you use the following:
CurrencyManager cm = (CurrencyManager)dataGrid1.BindingContext[
  dataGrid1.DataSource, dataGrid1.DataMember</code>];
This ensures that if you set only DataSource to a DataTable, or set the DataSource to the DataSet and the DataMember to the table name (which is recommended for data navigation or to support multiple table views if binding multiple tables throughout the lifetime of that particular DataGrid), that either works. The binding context must be exactly the same as how you bound your data, or it will not work.

Finally, debug your application or add some debugging code to make sure that the DataSet actually includes changes (which could be a result of not binding correctly, as I stated above). You can do this easy by using DataSet changes = ds.GetChanges();</pre>That will filter out all the unchanged data so you don't have to sift through so much, since examining <code>DataSets in the variables windows is difficult (Whidbey, i.e. Visual Studio 2005, will improve this with debugging viewers for various types of objects, which is also extensible for your own objects).

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralEditing custom file formats Pin
Gleb Belov5-Feb-05 22:48
Gleb Belov5-Feb-05 22:48 
GeneralRe: Editing custom file formats Pin
Robert Rohde5-Feb-05 23:31
Robert Rohde5-Feb-05 23:31 
GeneralRe: Editing custom file formats Pin
Gleb Belov6-Feb-05 3:41
Gleb Belov6-Feb-05 3:41 
GeneralRe: Editing custom file formats Pin
mav.northwind6-Feb-05 3:51
mav.northwind6-Feb-05 3:51 
GeneralRe: Editing custom file formats Pin
Gleb Belov6-Feb-05 4:04
Gleb Belov6-Feb-05 4:04 
GeneralRe: Editing custom file formats Pin
Dave Kreskowiak7-Feb-05 4:08
mveDave Kreskowiak7-Feb-05 4:08 
Question[Are these maybe Macros ?? ] How can i do it? Pin
Anonymous5-Feb-05 22:07
Anonymous5-Feb-05 22:07 
AnswerRe: [Are these maybe Macros ?? ] How can i do it? Pin
Heath Stewart6-Feb-05 6:56
protectorHeath Stewart6-Feb-05 6:56 
QuestionNetwork Monitoring in C#? Pin
TroyPalmer5-Feb-05 21:53
TroyPalmer5-Feb-05 21:53 
AnswerRe: Network Monitoring in C#? Pin
TroyPalmer8-Feb-05 11:38
TroyPalmer8-Feb-05 11:38 
Generalthreadsafe / static, general utilities Pin
pkellner5-Feb-05 20:32
pkellner5-Feb-05 20:32 
GeneralRe: threadsafe / static, general utilities Pin
Heath Stewart6-Feb-05 6:43
protectorHeath Stewart6-Feb-05 6:43 
GeneralRe: threadsafe / static, general utilities Pin
pkellner6-Feb-05 12:21
pkellner6-Feb-05 12:21 
GeneralRe: threadsafe / static, general utilities Pin
Heath Stewart7-Feb-05 6:31
protectorHeath Stewart7-Feb-05 6:31 
GeneralRe: threadsafe / static, general utilities Pin
Heath Stewart6-Feb-05 6:48
protectorHeath Stewart6-Feb-05 6:48 
GeneralRe: threadsafe / static, general utilities Pin
pkellner6-Feb-05 12:19
pkellner6-Feb-05 12:19 
QuestionDifferent ways to persist/share temporary data across classes in a multi-tier WinForm Application? Pin
DaMagicMaster5-Feb-05 20:07
DaMagicMaster5-Feb-05 20:07 

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.