Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to insert data into new rows and edit existing rows of data grid in db table.I have set in datagrid CanUserAddRows="True" in xaml .Here is my sqlite code for connecting with datagrid:


SQLiteCommand comm = new SQLiteCommand("update Security_details set id=@id,Code=@Code,Description=@Description,Rate=@Rate,Qty=@Qty,Amount=@Amount,Remarks=@Remarks where id=@id", sqlitecon);
comm.ExecuteNonQuery();

Tell me the set of commands for above query for inserting and updating data into data grid rows ?

I am first time coding in wpf using data grid .I search it on google the material i found is using entity frame work for this operation on datagrid..please help
Posted
Updated 11-Oct-13 0:37am
v2
Comments
Member 8840306 11-Oct-13 6:34am    
My sqlite code for inserting db table into datagird is:

sqlitecon.Open();
string Query2 = "Select * from Security_details ";
SQLiteCommand createCommand2 = new SQLiteCommand(Query2, sqlitecon);
createCommand2.ExecuteNonQuery();
SQLiteDataAdapter dataAdp2 = new SQLiteDataAdapter(createCommand2);
DataTable dt2 = new DataTable("Security_details");
dataAdp.Fill(dt2);
datagrid_security.ItemsSource = dt2.DefaultView;
dataAdp2.Update(dt2);
sqlitecon.Close();

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900