Hi all
im trying to update a datagrid table and below is the code i have been using but every time i run it i get an error:
Error:
System.NullReferenceException was unhandled
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=WindowsFormsApplication6
private void button6_Click(object sender, EventArgs e)
{
string sql = "Insert into [Sheet1$](first,last) Values(`" + textBox1.Text + "`, `" + textBox2.Text + "`)";
connect.Open();
OleDbDataAdapter adap = new OleDbDataAdapter(sql, connect);
adap.SelectCommand.ExecuteNonQuery();
adap.Dispose();
connect.Close();
connect.Dispose();
MessageBox.Show("Saved");
}