this my code insert in accdb using visual c# ........the column data type text,number(double,percentage) like this ...i try to fill all text box the value inserted ...
but i try to click without entering values ,receive this error .another error is if i insert single text box value ,other was empty also this error
this error
+ Execute NonQuery "insert into hhh VALUES('' ,'','','','','mmm','','','','','','','','','','','','','','','','')" Command Text = "insert into hhh VALUES('' ,'','','','','mmm','','','','','','','','','','','','','','','','')", Connection String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\data\\ggg.accdb"
returning number of row affected
What I have tried:
private void button1_Click(object sender, EventArgs e)
{
cmd = new OleDbCommand("insert into hhh VALUES('" +
textBox1.Text + "' ,'" + textBox2.Text + "','" +
textBox3.Text + "','" + textBox4.Text + "','" +
textBox5.Text + "','" + textBox6.Text + "','" +
textBox7.Text + "','" + textBox8.Text + "','" +
textBox9.Text + "','" + textBox10.Text + "','" +
textBox11.Text + "','" + textBox12.Text + "','" +
textBox13.Text + "','" + textBox14.Text + "','" +
textBox15.Text + "','" + textBox16.Text + "','" +
textBox17.Text + "','" + textBox18.Text + "','" +
textBox19.Text + "','" + textBox20.Text + "','" +
textBox21.Text + "','" + textBox22.Text + "')");
con.Open();
int n = cmd.ExecuteNonQuery();
if (n > 0)
{
MessageBox.Show("Record Submitted", "Congrats");
}
else
MessageBox.Show("insertion failed");
con.Close();
}