I have programmatically binding the RadSpreadsheet control with the values from my SQL Table. When the user modifies the cells value in RadSpreadsheet, i want only those modified cell values to be updated in my table.
I browsed the forum and I found CustomDatabaseProvider can be used or this operation. However, the example that I had was truncating the entire data from table instead of updating only the modified row.
public override void SaveWorkbook(Workbook workbook)
using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["SpreadsheetSampleConnectionString"].ConnectionString))
string query = "DELETE FROM [Products]";
SqlCommand clearCmd = new SqlCommand(query, conn);
string insertQuery = "INSERT INTO Products(ProductName,Description) VALUES(@param1,@param2)";
foreach (var row in workbook.Sheets.Rows)
SqlCommand insertCmd = new SqlCommand(insertQuery, conn);
insertCmd.Parameters.Add("@param1", SqlDbType.NVarChar, 50).Value = row.Cells.Value;
insertCmd.Parameters.Add("@param2", SqlDbType.NVarChar, 50).Value = row.Cells.Value;
insertCmd.CommandType = CommandType.Text;
Can anyone let me know how to do this?