Hi
I am having trouble to add new record to my database. Without assign anything to the primary key field I am keep getting an error says "string or binary data would be truncated, statement terminated" I have set the PK field to Auto Increment so I don't really want to insert ids myself.
Please help:
DataRow row = ds.Tables[0].NewRow();
row[0] = ????
row[1] = textBox1.Text;
row[2] = textBox3.Text;
ds.Tables[0].Rows.Add(row);
try
{
objConnect.UpdateDatabase(ds);
MaxRows = MaxRows + 1;
inc = MaxRows - 1;
MessageBox.Show("New Record Added");
}
catch(Exception err)
{
MessageBox.Show(err.Message);
}
I am having trouble to add new record to my database. Without assign anything to the primary key field I am keep getting an error says "string or binary data would be truncated, statement terminated" I have set the PK field to Auto Increment so I don't really want to insert ids myself.
Please help:
DataRow row = ds.Tables[0].NewRow();
row[0] = ????
row[1] = textBox1.Text;
row[2] = textBox3.Text;
ds.Tables[0].Rows.Add(row);
try
{
objConnect.UpdateDatabase(ds);
MaxRows = MaxRows + 1;
inc = MaxRows - 1;
MessageBox.Show("New Record Added");
}
catch(Exception err)
{
MessageBox.Show(err.Message);
}