RT. 主键,什么之类的用了自动编号。。 @@identity select top 1 * from TUT order by id desc 倒着排序 然后top 1 或者时间排序 top 1 插入完了执行 select @@identity http://topic.csdn.net/u/20100427/13/bc530552-1f76-4a34-9b53-3a77d6a675a7.html top 1的会怕并发。。 存储过程的确是个好办法。 但是我用的是ACCESS。。。ORZ...
还有啥方法吗。。谢谢 正解!!~ Insert Into DataTable(...);Select @@Identity
在insert语句后面之间加SELECT SCOPE_IDENTITY()
int num = 0; com.CommandText = "insert into news(title) values('标题1') select @@identity"; com.Connection = conn; num = Convert.ToInt32(com.ExecuteScalar()); Response.Write(num.ToString());
Microsoft JET Database Engine '80040e07' 标准表达式中数据类型不匹配。 \wwwroot\update.asp, line 20 -------------------------------------------------------------------------------- Ho ......