如果不考虑性能,你也可以分几步啊
cmb.CommandText="selet t1id from table1 where myid=参数";
object t1id=cmb.ExecuteScalar();
if(tlid!=null && tlid!=System.DBNull.Value) //先查出tlid
{
cmb.CommandText="delete from table1 where myid=参数";
cmb.ExecuteNonquery();
cmb.CommandText="upate table2 set t2id=t2id+1 where t1id=" + t1id.ToString();
cmb.ExecuteNonquery();
}
我知道用“upate table2 set t2id=t2id+1 where t1id=(selet t1id from table1 where myid=参数);delete from table1 where myid=参数 ”同时执行两条语句也能实现 ,
但我主要是想知道,如何分成两步,得到我想到的数据后,再执行第二条语句 。