Hi,
The code that you see its help to remove (ou delete) one column. Its works fine.
But the problem is I need to put a condition save logic. Its should show a dialog that allow if or not possible to save. Its show this dialog message but when I click yes its display this message error: Additional information: object reference not defined for instance object
- private void btnDelete_Click(object sender, EventArgs e)
- {
- if (conn.State != ConnectionState.Open)
- conn.Open();
- OleDbCommand cmd = new OleDbCommand();
- comm.Connection = conn;
- if (MessageBox.Show("Are you sure to save?", "Save window", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- try
- {
- cmd = new OleDbCommand("ALTER TABLE Billing DROP COLUMN ID ", conn);
- comm.ExecuteNonQuery();
- }
- Finally
- {
- conn.Close();
- }
- }
- }