23 July 2016

How to save datagridview to access database c#

for(int i = 0; i < DGV.Rows.Count - 1; i++)
                {
                    p1.cmd = new OleDbCommand("insert into pmaster(name,sname,type,gro,code,odate) values ('" + C2.Text.Trim() + "','" + DGV[1,i]+"','"+C3.Text+"','"+C1.Text.Trim()+"','"+textBox1.Text.Trim()+"','"+DateTime.Now.Date+"')",p1.Cn);
                    p1.cmd.ExecuteNonQuery();
                }

No comments:

Post a Comment