i try to insert data into Access with this code but can't it gives me error message pointing at the int n = cmd.ExecuteNonQuery()(the field is too small to accept the amount of data you attempted to add. try inserting or pasting less data)
private void butInsert_Click(object sender, EventArgs e)
{
cmd = new OleDbCommand("insert into books values(" + txtIsdn.Text + ",' " + txtTitle.Text + " ',' " + txtAuthor.Text +
" ',' " + txtPublisher.Text + " ',' " + txtSubject.Text + " ',' " + txtShelf.Text + " ',' " + txtFiction.Text + " ')", con);
con.Open();
int n = cmd.ExecuteNonQuery();
con.Close();
if (n > 0)
{
MessageBox.Show("Record inserted");
loaddata();
}
else
MessageBox.Show("insertion failed");
pls someone should help me out
private void butInsert_Click(object sender, EventArgs e)
{
cmd = new OleDbCommand("insert into books values(" + txtIsdn.Text + ",' " + txtTitle.Text + " ',' " + txtAuthor.Text +
" ',' " + txtPublisher.Text + " ',' " + txtSubject.Text + " ',' " + txtShelf.Text + " ',' " + txtFiction.Text + " ')", con);
con.Open();
int n = cmd.ExecuteNonQuery();
con.Close();
if (n > 0)
{
MessageBox.Show("Record inserted");
loaddata();
}
else
MessageBox.Show("insertion failed");
pls someone should help me out