CNN.Execute sql
sql = "select @@identity as qq"
Set rs_temp = CNN.Execute(sql)
temp_id = rs_temp("qq").Value
sql = "select @@identity as qq"
Set rs_temp = CNN.Execute(sql)
temp_id = rs_temp("qq").Value
解决方案 »
- 如何用vb获取局域网内的所有Oracle数据库服务器列表?用代码如何实现?分不够可以再加
- 怎样读word文档到richtext中???????????
- 怎样实现将程序最小化时隐藏到windows的工具栏里,就好象金山词霸那样?(肯定给分)
- 关于mdac打包的问题!
- 再问一次!(解决者给40分)
- 大家好小弟遇到问题了,有谁可以帮忙呀!!!
- 我8月17号汇款到csdn买vs.net beta2的,可是他现在升价了,是30,但是我只寄了20,会有问题吗?还有,他们现在还没有收到款,是否有点问题??我在广东肇庆。。
- 该死的ADODC和DATAGRID!
- 一个初学VB者的困惑!
- ?在平面直角坐标系中知道了某直线在y轴上的截距(起始点的坐标)及它与x轴的夹角θ,如何画出此直线???
- 急!MSHFlexGrid控件显示数据的排序问题 马上结题
- 求源代码!
Set rs_temp = CNN.Execute(sql)
表示rs_temp 是记录集合 CNN.Execute(sql) 表示执行上面的sql语句产生结果赋值给rs_temp
temp_id = rs_temp("qq").Value表示变量temp_id 的值为记录集合rs_temp的第一条记录中字段identity或者说是QQ的值
sql: a String that holds an SQL statement of "select @@identity as qq". I don't think the SQL statement makes much sense. However, basically it renames @@identity to qq. Set rs_temp = CNN.Execute(sql)
Execute the SQL statement defined in sql by do an Execute on CNN. Note CNN here is the Connection object. This will return a ResultSet object, which is passed to variable rs_temp. temp_id = rs_temp("qq").Value
Now we want to fetch the value of column "@@identity". Note "@@identity" is the same as "qq" or is exposed as "qq" in the first line. The feteched value is stored in temp_id variable.Hope this helps!
例如﹕sql = "select @@identity as qq"
Set rs_temp = CNN.Execute(sql)
rs_temp得到的是重哪里反回的记录集再次感謝各位的關注
sql = "select @@identity as qq" '设置SQL语句,取得字增值主键的值,放入别名为QQ的字段里
Set rs_temp = CNN.Execute(sql) '执行SQL语句,CNN是ADO的数据链接,将返回的结果赋值给记录集
temp_id = rs_temp("qq").Value '从记录集中取出数据,放入变量
use pubs
INSERT INTO jobs (job_desc,min_lvl,max_lvl)
VALUES ('Accountant',12,125)
SELECT @@IDENTITY AS 'Identity'result
--------------------
Identity
1 15