<pre lang="cs">string cb = "insert into Stock(StockID,ConfigID,Quantity,TotalPrice,StockDate)Values(@StockID,@ConfigID,@Quantity,@TotalPrice,@StockDate)";
cmd = new SqlCommand(cb,con);
cmd.Connection = con;
cmd.Parameters.AddWithValue("@StockID", txtStockID.Text);
cmd.Parameters.AddWithValue("@ConfigID",txtConfigID.Text);
cmd.Parameters.AddWithValue("@Quantity",txtQty.Text);
cmd.Parameters.AddWithValue("@TotalPrice",txtTotalPrice.Text);
cmd.Parameters.AddWithValue("@StockDate",dtpStockDate.Value.ToShortDateString());
cmd.ExecuteReader();
con.Open();
cmd.ExecuteNonQuery();
con.Close();