Iam creating one application where data inserted into access table using datagridview but issue is two value(s) are inserted correctly but when im trying to insert numeric value its inserted as 0
private void dataGridView1_RowLeave(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView1.IsCurrentRowDirty)
{
string connectionString = null;
connectionString = ConfigurationManager.ConnectionStrings["AccessConnectionString"].ConnectionString;
con.ConnectionString = connectionString;
string cmd1 = "insert into Medicine_Available_Detail([Medicine_Name],[Dealer_name],[total_available])values(?,?,?)";
OleDbCommand cmd = new OleDbCommand(cmd1, con);
cmd.CommandType = CommandType.Text;
string Medicine_Name = dataGridView1.Rows[e.RowIndex].Cells["Medicine_Name"].Value.ToString();
cmd.Parameters.AddWithValue("@Medicine_Name", Medicine_Name);
string Dealer_name = dataGridView1.Rows[e.RowIndex].Cells["Dealer_name"].Value.ToString();
cmd.Parameters.AddWithValue("@Dealer_name", Dealer_name);
Praveen SreeramRank #134 · 16.8K reputationPosted Jun 24, 2016, 10:27 PM EDT
Atul Rokade146 reputationPosted Jun 24, 2016, 11:47 PM EDT
Praveen SreeramRank #134 · 16.8K reputationPosted Jun 25, 2016, 2:34 AM EDT
Atul Rokade146 reputationPosted Jun 25, 2016, 5:20 AM EDT
Praveen SreeramRank #134 · 16.8K reputationPosted Jun 25, 2016, 6:55 AM EDT
Atul Rokade146 reputationPosted Jun 25, 2016, 8:21 AM EDT
Praveen SreeramRank #134 · 16.8K reputationPosted Jun 25, 2016, 8:55 AM EDT
Vinay SinghRank #604 · 4K reputationPosted Jun 25, 2016, 9:42 PM EDT
Atul Rokade146 reputationPosted Jun 25, 2016, 10:44 PM EDT
Praveen SreeramRank #134 · 16.8K reputationPosted Jun 25, 2016, 10:47 PM EDT
Atul Rokade146 reputationPosted Jun 25, 2016, 10:48 PM EDT
Praveen SreeramRank #134 · 16.8K reputationPosted Jun 26, 2016, 3:17 AM EDT
Atul Rokade146 reputationPosted Jun 26, 2016, 9:15 AM EDT
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts