我不确定如何准确地表达问题标题。
我有这段代码为执行插入的存储过程设置我的 sql 参数。
Dim sproc As StoredProcedure = New StoredProcedure("UsersInsert2", DataAccessConfiguration)
sproc.AddInput("@ID", SqlDbType.NVarChar, 10, entity.UserId)
sproc.AddInput("@PCode", SqlDbType.SmallInt, entity.PriviledgeCode)
sproc.AddInput("@Pwd", SqlDbType.NVarChar, 10, entity.Password.ToString())
sproc.AddInput("@Lang", SqlDbType.NVarChar, 1, entity.DefaultLanguage)
sproc.AddInput("@Name", SqlDbType.NVarChar, 40, entity.UserName)
sproc.AddInput("@Notice", SqlDbType.TinyInt, entity.SaveNotice)
sproc.AddInput("@CreatedBy", SqlDbType.VarChar, 50,CurrentUserCredentials.UserName)
我已经在 SSMS 中测试了存储过程,它可以工作。问题是当我尝试从应用程序中调用它时。它失败。@@rowcount = -1。我试过从数据库返回一个错误代码......没有骰子。一直返回为-1
什么会被执行看起来像这样
sproc = {EXEC UsersInsert2 @ID=ruxtest7, @PCode=0, @Pwd=1234, @Lang=E, @Name=ruxpint, @Notice=1, @CreatedBy=ruxpint}
知道问题是什么吗?我已经多次重复使用此代码。唯一的区别是我使用的是 NVarChar,它是 vb.net。
谢谢。
TR