insert into person (name,depart_id) values ('n',1)改为insert person (name,depart_id) values ('n',1)

解决方案 »

  1.   

    CREATE PROCEDURE [dbo].[useradd] AS
    insert into person (name,depart_id) values ('n',1)
    select max(id) from person
    return --遇到这个return 就结束了本次事务
    GO
      

  2.   

    begin
    insert person (name,depart_id) values ('n',1)
    end
    return select max(id) from person
      

  3.   

    筒子们,大家说的都试了,问题没解决啊,继续。下面贴上VB的前端处理代码,再帮我看看吧    Dim comtemp As New ADODB.Command
        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)
      

  4.   


    CREATE PROCEDURE [dbo].[useradd] AS
    exec 'insert into person (name,depart_id) values ('n',1)'
    exec 'select max(id) from person'
    GO
      

  5.   

    存储过程,没有什么问题,可以运行,看你程序中代码吧!
    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   
      

  6.   

    存储过程,没有什么问题,可以运行,看你程序中代码吧!
    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   ---------------------------
    过程名称不对!
      

  7.   

    问题已解决,谢谢大家的参与,存储过程本身并无问题。问题出在程序中,有两点。1、未设置  comtemp.activeconnection
    2、未执行command
    应该加上 comtemp.execute