chanaka anurada

chanaka anurada

  • NA
  • 22
  • 1.1k

inserting Data to SQL DB

May 8 2019 7:04 AM
please help me to to slove this matter!!! 
 
  1. SqlConnection con = new SqlConnection("Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\\RmDb.mdf;Integrated Security=True");  
  2. con.Open();  
  3. SqlCommand com= new SqlCommand("INSERT INTO RmPro(AOD_Number,Material_type,Lot_Number,ID_Number,Gross_weight,Pallet_weight,Net_weight,Expire_date,Shift)VALUES(@AOD_Number,@Material_type,@Lot_Number,@ID_Number,@Gross_weight,@Pallet_weight,@Net_weight,@Expire_date,@Shift)", con);  
  4. com.Parameters.AddWithValue("@AOD_Number", txtGrAod.Text);  
  5. com.Parameters.AddWithValue("@Material_type", txtGrMt.Text);  
  6. com.Parameters.AddWithValue("@Lot_Number", txtGrLot.Text);  
  7. com.Parameters.AddWithValue("@ID_Number", txtGrId.Text);  
  8. com.Parameters.AddWithValue("@Gross_weight", txtGrGw.Text);  
  9. com.Parameters.AddWithValue("@Pallet_weight", txtGrPw.Text);  
  10. com.Parameters.AddWithValue("@Net_weight", txtGrNw.Text);  
  11. com.Parameters.AddWithValue("@Expire_date", dtpGrxp.Text);  
  12. com.Parameters.AddWithValue("@Shift", txtGrShift.Text);  
  13. com.ExecuteNonQuery();  
  14. con.Close(); 
giving Error :
 
 
 

Answers (2)