ashwini bhingole

ashwini bhingole

  • NA
  • 7
  • 15.7k

insert records in database from datagridview.

Dec 17 2011 4:40 AM

Insert Records in Database from datagridview. my code is--



SqlDataAdapter da = new SqlDataAdapter("select * from GradeDGV", con);
da.InsertCommand = new SqlCommand("insert into GradeDGV (Proportions,Percentage,Quantity) values(@Proportions, @Percentage, @Quantity)", con);
da.InsertCommand.Parameters.Add("@Proportions", SqlDbType.VarChar, 10, "Proportions");
da.InsertCommand.Parameters.Add("@Percentage", SqlDbType.Decimal, 10, "Percentage");
da.InsertCommand.Parameters.Add("@Quantity", SqlDbType.Decimal, 10, "Quantity");

DataSet ds = new DataSet();
da.Fill(ds);
DGV_grade.DataSource = ds;


tell me solution as soon as possible.

Answers (4)