记录插进数据库了,怎么立即获得本记录的ID? 前题条件:id 为自动增长型set @id=@@identity 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 是自动编号的ID吗?那就这样select @@identity 对了,是在ASP里面啊(ASP操作 MS SQL SERVER ,关外一个客户用老掉牙的系统,让我改点东东)ID是自动编号记录插进数据库了,怎么用ASP立即获得本记录的ID? rdtemp.Open "Select @@identity as Fid", pData, adOpenStatic, adLockReadOnly rs.open "select * from table1 where id is null",conn,1,3cursorLocation=2rs.addnewrs("name")="dxy"..rs.updateid_new=rs("id")rs.close 我是这样写的,可是运行 有错,错在哪里呢?sql="SET NOCOUNT ON;insert into t_lesson_info(lessonbh,itemnotes,startdate,enddate,lessontime," sql=sql & "teacher,lessonway,testway,lessonbook,notes,personnum,score,inputtime) values (" sql=sql & "'" & lessonbh & "','" & itemnotes & "','" & startdate & "','" & enddate & "','" & lessontime & "','" sql=sql & teacher & "','" & lessonway & "','" & testway & "','" & lessonbook & "','" & notes & "','" sql=sql & personnum & "','" & score & "','" & submittime & "');SELECT @@IDENTITY;SET NOCOUNT OFF" set rooidRS=conn.execute sql If rooidRS.EOF Then Response.Write "NO the item!" : Response.End lesson_id=rooidRS("0") SQL基础 添加记录的时候出了问题.不知道是怎么回事.请教 书上一言:应用程序可能会直接操作内模式而不是外模式. 当然,这种做法肯定是不妥的, 这会带来一定的操作隐患. 我想查询人员2004年6月份在职人员总数如何得之? 50分:请教 在哪里设置“DBO USE ONLY”? 如何查询出表中缺损数据的字段值?字段值是数字且有范围. 我在sql server enterprise manager里创建了一个数据库,为什么他自动建立了一些表,视图……数据库对象?? 按日期模糊查询检索数据 数据库剔重的优化!!! 三表联查,菜鸟求助 求救,有关分组字符相加问题 加了个like出错了?
select @@identity
ID是自动编号
记录插进数据库了,怎么用ASP立即获得本记录的ID?
rs.open "select * from table1 where id is null",conn,1,3
cursorLocation=2
rs.addnew
rs("name")="dxy"
..
rs.update
id_new=rs("id")
rs.close
sql=sql & "teacher,lessonway,testway,lessonbook,notes,personnum,score,inputtime) values ("
sql=sql & "'" & lessonbh & "','" & itemnotes & "','" & startdate & "','" & enddate & "','" & lessontime & "','"
sql=sql & teacher & "','" & lessonway & "','" & testway & "','" & lessonbook & "','" & notes & "','"
sql=sql & personnum & "','" & score & "','" & submittime & "');SELECT @@IDENTITY;SET NOCOUNT OFF"
set rooidRS=conn.execute sql
If rooidRS.EOF Then Response.Write "NO the item!" : Response.End
lesson_id=rooidRS("0")