saumya vishnoi
saumya vishnoi

Reputation: 137

Drop table in access using oledb in c#

I am trying to delete the whole table created in access through coding in c#.

I am currently using the following coding:

      string dstr = "DROP TABLE [" + in_table + "] ";
            OleDbCommand cmd1 = new OleDbCommand(dstr, con);
            cmd1.ExecuteNonQuery();

I am getting a syntax error in the above command. I try without square brackets also, but the error remains the same.

I know there must be some silly mistake in the above command, but if anyone can put the correct command, I would be really thankful.

Upvotes: 1

Views: 3429

Answers (1)

Habib
Habib

Reputation: 223282

Make sure in_table has some valid table name. Put a break point and watch. Also you may put semicolon (;) at the end of the statement (not compulsory though).

Upvotes: 1

Related Questions