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");
}
Loading
Vinitha TPosted Nov 9, 2021, 1:17 PM
SenthilkumarPosted Mar 12, 2012, 5:00 AM
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");
}
Please check it out and if it is useful then mark it as Accept Answer