I've this code to create a table if it doesnt exists:
MessageBox.Show("create table");
conn.Open();
SqlCommand command = new SqlCommand("IF OBJECT_ID('UXMenu', 'U') IS NULL CREATE TABLE UXMenu(ID int PRIMARY KEY AUTOINCREMENT, TransDocument char(5), TransSerial char(5), TransDocNumber float, PartyName char(60), PartyLocalityID char(5), TotalAmount char (25), ShipToPostalCode char(35), Estado int);", conn); command.ExecuteNonQuery();
MessageBox.Show("tabela criada");
conn.close();
But this code isnt working, I get the first messagebox but then it just ignores the rest of the code and doesnt create anything.
What I have tried:
MessageBox.Show("create table");
conn.Open();
SqlCommand command = new SqlCommand("IF OBJECT_ID('UXMenu', 'U') IS NULL CREATE TABLE UXMenu(ID int PRIMARY KEY AUTOINCREMENT, TransDocument char(5), TransSerial char(5), TransDocNumber float, PartyName char(60), PartyLocalityID char(5), TotalAmount char (25), ShipToPostalCode char(35), Estado int);", conn);
command.ExecuteNonQuery();
MessageBox.Show("tabela criada");
conn.close();