insert数据时,获取插入数据的id

当运行完插入语句后,执行select @@identity就可得到自动生成的id

如果是sql server 最好用select SCOPE_IDENTITY() as id