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

SenthilkumarRank #387 · 6.5K reputationPosted Mar 12, 2012, 1:00 AM EDT
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
Vinitha TRank #8,005 · 230 reputationPosted Nov 9, 2021, 8:17 AM EST