挑战增加ID!
set CC=server.createobject( "ADODB.recordset ")
sql= "select max(F_ID)+1 F_ID from nh_fsms "
CC=conn.Execute(sql)
F_ID=CC( "F_ID ")
conn.execute( "insert into nh_fsms(F_ID,F_Dst) values( ' "&F_ID& " ', ' "&DstMobile& " ') ")
选出最大记录加1
但如果原记录为空时,插入的记录也为空。
应该加上一个怎样的条件判断?
ASP中如何写?
------解决方案--------------------set CC=server.createobject( "ADODB.recordset ")
sql= "select max(F_ID)+1 F_ID,count(*) Cnt from nh_fsms "
CC=conn.Execute(sql)
F_ID=CC( "F_ID ")
If CC( "cnt ")> 0 then
conn.execute( "insert into nh_fsms(F_ID,F_Dst) values( ' "&F_ID& " ', ' "&DstMobile& " ') ")
end if