Israel

Israel

  • 701
  • 1.3k
  • 217.2k

Reinitialize the Id column

Mar 27 2018 11:03 AM
Hi,
 
I have a small table with two columns: Id and name. But I need to reintialize my Id column anytime I need. I do write this code to see if its can works properly. But after running and click to my button. I receive an error message that say: error syntax in column definition
 
Anyone can Help please.
  1. private void button1_Click(object sender, EventArgs e)  
  2. {  
  3. OleDbCommand comm = new OleDbCommand("ALTER TABLE myTable ALTER " + " COLUMN Id AUTOINCREMENT(" + textBox1.Text + ",1)", conn);  
  4. conn.Open();  
  5. comm.ExecuteNonQuery();  
  6. comm.Dispose();  
  7. conn.Close();  
  8. MessageBox.Show("Ok");  
  9. }

Answers (3)