execute可以执行select语句,执行update语句程序就挂,请各位大虾帮忙看看
oracle数据库数据连接
conn1.connectionstring="provider=msdaora.1;password=123456;user id=ttpp;data source=ttpp22;persist security info=true"
conn1.opensub中
str1="select * from table1"
conn1.execute str1,a
这里运行正常,a的值为-1str1="update table1 set zdqh='1230' where id<'1015'"
conn1.execute str1,a
我想获取update语句影响的记录数,运行到这里挂了update table1 set zdqh='1230' where id<'1015' 这个语句在PL/SQL中运行正常。
可执行结果里面a=4,完全是在integer的范围内,这是为什么?
Optional. A Long variable to which the provider returns the number of records that the operation affected.
执行指定的查询、SQL 语句、存储过程或特定提供者的文本等内容。语法对于不按行返回的命令字符串:connection.Execute CommandText, RecordsAffected, Options 对于按行返回的命令字符串:Set recordset = connection.Execute (CommandText, RecordsAffected, Options)返回值返回 Recordset 对象引用。参数CommandText 字符串,包含要执行的 SQL 语句、表名、存储过程或特定提供者的文本。RecordsAffected 可选,长整型变量,提供者向其返回操作所影响的记录数目。
你的变量要能放得下长型数据才会正确。
整型变量肯定放不下长整的数据。
另,数据类型与数值并不是一回事。