insert into person (name,depart_id) values ('n',1)改为insert person (name,depart_id) values ('n',1)
解决方案 »
- 请教高手们都是在什么里面写sql?
- 多表运算的存储过程
- 一百多个数据库,如何实现批量恢复数据库
- 怎样用sql语句设置某数据库的登陆帐号及密码?
- driver's SQLALLOCHANDLE ON SQL_HANDLE_ENV FAILED
- MSSSQL存储过程出现一个不解的错误,求教指点
- 求助一个很多人都想解决的问题,关于数据复制同步的。
- 为什么得到的查询结果不正确,请指教
- 关于选择数据的问题,请专家帮我解决。
- 请问Informix和Oracle是否支持类似SQL Server的TOP与ORDER BY配合使用的功能
- 怎样把一个表的数据复制到另一个表,两个表的结购相同
- 请问在查询分析器中如何修改列的字段类型?我的操作提示失败。。。紧急!!!
insert into person (name,depart_id) values ('n',1)
select max(id) from person
return --遇到这个return 就结束了本次事务
GO
insert person (name,depart_id) values ('n',1)
end
return select max(id) from person
Dim pmttemp(0) As New Parameter With pmttemp(0)
.Direction = adParamReturnValue
.name = "@return"
.Type = adTinyInt
End With
comtemp.CommandType = adCmdStoredProc
comtemp.CommandText = "useradd"
comtemp.Parameters.Append pmttemp(0)
CREATE PROCEDURE [dbo].[useradd] AS
exec 'insert into person (name,depart_id) values ('n',1)'
exec 'select max(id) from person'
GO
Dim ADOCom As New ADODB.Command
With ADOCom
.ActiveConnection = ****** '数据库连接
.CommandType = adCmdStoredProc
.CommandText = "C2C_useradd_Operate"
.Parameters("@Name").Value = "asdf"
.Parameters("@id").Value = 1
.Execute
MsgBox Trim(.Parameters("@maxid").Value)
End With
Dim ADOCom As New ADODB.Command
With ADOCom
.ActiveConnection = ****** '数据库连接
.CommandType = adCmdStoredProc
.CommandText = "useradd"
.Parameters("@Name").Value = "asdf"
.Parameters("@id").Value = 1
.Execute
MsgBox Trim(.Parameters("@maxid").Value)
End With ---------------------------
过程名称不对!
2、未执行command
应该加上 comtemp.execute