We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Saving data to database

Thread ID:

Created:

Updated:

Platform:

Replies:

115941 Mar 3,2014 10:57 AM UTC Nov 16,2018 04:08 AM UTC WinRT 5
loading
Tags: SfDataGrid
madhu
Asked On March 3, 2014 10:57 AM UTC

Hi,

     I have created a datagrid in which I can add new rows and edit them. However I am not getting any useful link regarding saving the data to a SQLite database. Kindly help


Jai Ganesh S [Syncfusion]
Replied On March 7, 2014 12:47 PM UTC

Hi Madhu,

 

Thank you for using Syncfusion products.

 

We have analyzed your query. You can save the datas in SfDataGrid to the database by using SfDataGrid’s “RowValidated event”.

 

Please let us know if you need further assistance.

 

Thank you,

Jai Ganesh S


red
Replied On November 12, 2018 05:41 PM UTC

Can you give us an example  by using "RowValidated event " with sqlserver database and uwp app  please

Deivaselvan Y [Syncfusion]
Replied On November 13, 2018 08:40 AM UTC

Hi Red,

Thank you for contacting Syncfusion support.

We have prepared sample using SQLite DB. We have maintained the database locally to save the insert, update and retrieve the data from the database. For inserting new record by handling RowValidating event and also updating edited data by handling RowValidated event as like below code snippet 
 
// for inserting new record in SQLite DB  
this.datagrid.RowValidating += Datagrid_RowValidating;  
  
private void Datagrid_RowValidating(object sender, Syncfusion.UI.Xaml.Grid.RowValidatingEventArgs e)  
{      
    try  
    {  
        if (database.conn == null 
            return 
        var data = (e.RowData as OrderItem);  
        var id = data.ID;  
        var name = data.Name;  
        var query = "INSERT INTO OrderItem (ID,Name) VALUES ('" + data.ID + "','" + data.Name + "')" 
        database.conn.Query<OrderItem>(query);  
  
    }  
    catch { }  
 
  
//for updating edited record in SQLite DB  
this.datagrid.RowValidated += Datagrid_RowValidated;  
  
private void Datagrid_RowValidated(object sender, Syncfusion.UI.Xaml.Grid.RowValidatedEventArgs e)  
{      
    try  
    {  
        if (database.conn == null 
            return 
        var data = (e.RowData as OrderItem);  
  
        var query1 = "UPDATE OrderItem SET Name='" + data.Name + "' WHERE ID='" + data.ID + "'" 
        database.conn.Query<OrderItem>(query1);  
    }  
    catch { }  
 
 
 
Sample Link :  
 
Please let us know if you need any further assistance. 
 
Regards,
Deivaselvan
 


red
Replied On November 14, 2018 07:48 AM UTC

Thank you very much for your help ,you give me an example with Sqllite that's fine too .
In general , I appreciate your quick response.
This is my first time using your product , You are doing excellent job .

Thanks Deivaselvan Y
  

Deivaselvan Y [Syncfusion]
Replied On November 16, 2018 04:08 AM UTC

Hi Red,

Thanks for your feedback. We are happy to assist you as always. Please let us know if you required any further assistance.

Regards,
Deivaselvan

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;