1
Answer

C# code to drop a table?

Ankita Ankita

Ankita Ankita

12y
5.3k
1
In following if condition is getting false n control jumps to else. Is my condition wrong? I get o/p as "Table is not dropped". what value is returned by executenonquery method for drop table?

con is object of sqlconnection.
cmd is object of sqlcommand


con.open();
string str=" Drop table temp";
cmd= new SqlCommand(str,con);
int r=cmd.executenonquery();
if(r>0)
{

       messagebox.show("Table is dropped");

}
else
{

    messagebox.show("Table is not dropped");
}
Answers (1)