Ticket Q561785
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

How to make sure that all modifications are saved

How to save changes made in the GridControl in the LINQ to SQL database

created 11 years ago

I have a project using linq
to sql query at runtime to retrieved data
to datagrid view It works and function fine but can not save to database ro
delete to database. Do you have a simple program to show me how to do that in
wincontrol?

Answers approved by DevExpress Support

created 11 years ago (modified 11 years ago)

Hi Farhad,
You want to save the data source changes made via our GridControl, right?
If so, refer to the following help article which contains all necessary information of how to accomplish this task:
How to Make Sure That All Modifications Are Saved
The main idea is to use the database's standard methods to save changes.
Using LINQ to SQL, the DataContext.SubmitChanges method serves for this purpose (refer to the How to: Submit Changes to the Database MSDN article for more information).
I suggest that you call this method in the GridView.RowUpdated event handler. Or choose another moment to save changes. For example, create a Save button and use its OnClick event handler for this purpose. Note that in this case it is necessary to call the PostEditor and UpdateCurrentRow methods as it is described at Posting Data to a Connected Database.
A similar issue has already been discussed in the how can i save changes from the GridControl to database thread.
Should you have further questions, feel free to contact us.

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.