Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ctrl+S is DataGrid does not save data
Message
From
03/01/2007 12:57:18
 
 
To
02/01/2007 18:46:11
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 1.1
Miscellaneous
Thread ID:
01181178
Message ID:
01181864
Views:
12
Bonnie,

I have 3 different classes containing Save() method:

form class Save() - called without parameters from grid. It calls form business object Save() method without parameters.

business object Save() - called without parameters from form. It calls data access object Save() by passing its DataTable and some other parameters you see to data access object.

There exist only one copy of DataTable in my application. This datatable lives in business object and its references are set as grid datasource and passed to data access object Save() method.
Also, when I press down arrow key before Ctrl+S, save work OK.
So I do'nt have duplicate datatables.

I can send the whole code to you if you are interested.

>Andrus,
>
>Now I'm thoroughly confused. You showed some Save() code that had parameters passed (like the DataSet) and you also showed Save() code that had no parameters, so I'm not sure what's getting passed where.
>
>You already said that when you set a breakpoint in the processcmdkey() method after the CurrencyManager.Refresh(), that the DataTable showed that the column had been updated correctly in the DataSet's DataTable. If this is then not being saved correctly in your Update, I can only conclude that you're not using the same data in your Save that calls the Update.
>
>You need to trace the flow of data in the debugger a little bit more.
>
>~~Bonnie
>
>
>
>
>>Bonnie,
>>
>>Ctrl+S invokes processcmdkey(). processcmdKey() method calls form Save, form Save calls business class Save and business class Save calls this data layer Save() method.
>>
>>>Andrus,
>>>
>>>In the code you posted previously, you are calling the .Update() from a Save() method. Where are you calling the Save() method?
>>>
>>>~~Bonnie
>>>
>>>
>>>
>>>
>>>>Bonnie,
>>>>
>>>>If I move to next row, all is OK. I use commandbuilder generated update command which includes all fields in table.
>>>>
>>>>So I think this is OK.
>>>>
>>>>The problem seems to related to pressing Ctrl+S without moving to other row. In this case driver Update() is not called at all.
>>>>I have no idea.
>>>>
>>>>
>>>>>Andrus,
>>>>>
>>>>>Have you checked that you have a valid PK? Have you checked that the various commands that the .Update() method uses is correct? (Put a breakpoint on the .Update() and check that stuff before it gets called).
>>>>>
>>>>>Personally, I don't use the .Update() method, I "roll-my-own" data access (setting parameters, calling .ExecuteNonQuery(), etc.), so I don't know how many other tips I might be able to give you for tracking this down further. Is there any way to see what gets sent to your database? In SQL Server, we can use Sql Profiler and it shows exactly what's getting sent to the server ... that's one way to tell if the commands are being formatted incorrectly or if the problem's on the server itself. I have no clue about the server you're using though.
>>>>>
>>>>>~~Bonnie
Andrus
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform