我想獲得一個存儲過程運行,併爲我的生活無法通過錯誤。SQL Server存儲過程。缺少參數錯誤,但參數肯定有
如果我將SQL從存儲過程中提取出來並放入硬編碼的ASP(Classic)中,它可以工作100%,所以它不是代碼。
我有大約8個其他類似的存儲過程,他們工作得很好,所以必須是這個特定的東西,但似乎無法找到什麼是錯的。
系統是一箇舊的Windows 2000和SQL Server 2000
錯誤:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Procedure 'lbg_UpdateUserRegInfo_ById' expects parameter '@email_mananger', which was not supplied.
/inc/db_users.asp, line 316
實際的存儲過程的代碼
ALTER PROCEDURE [dbo].[lbg_UpdateUserRegInfo_ById]
@id int,
@title nvarchar(10),
@firstname nvarchar(50),
@lastname nvarchar(50),
@jobtitle nvarchar(50),
@grade nvarchar(50),
@division nvarchar(50),
@department nvarchar(50),
@communitybank int,
@personalcontactnumber nvarchar(50),
@email nvarchar(75),
@linemanagerfirstname nvarchar(50),
@linemanagersurname nvarchar(50),
@groupmanagerfirstname nvarchar(50),
@groupmanagersurname nvarchar(50),
@seniorgroupmanagerfirstname nvarchar(50),
@seniorgroupmanagersurname nvarchar(50),
@email_mananger nvarchar(75),
@linked_manager_id int
AS
UPDATE lbg_userreginfo
SET
[title] = @title,
[firstname] = @firstname,
[lastname] = @lastname,
[jobtitle] = @jobtitle,
[grade] = @grade,
[division] = @division,
[department] = @department,
[communitybank] = @communitybank,
[personalcontactnumber] = @personalcontactnumber,
[email] = @email,
[linemanagerfirstname] = @linemanagerfirstname,
[linemanagersurname] = @linemanagersurname,
[groupmanagerfirstname] = @groupmanagerfirstname,
[groupmanagersurname] = @groupmanagersurname,
[seniorgroupmanagerfirstname] = @seniorgroupmanagerfirstname,
[seniorgroupmanagersurname] = @seniorgroupmanagersurname ,
[email_mananger] = @email_mananger,
[linked_manager_id] = @linked_manager_id,
[dt_modified] = GETDATE()
WHERE [id_userreginfo] = @id
經典的ASP代碼/功能我用的是下面( arrayUserRegInfo是一個Dictionary對象)
function db_UpdateUserRegInfo(ByRef arrayUserRegInfo)
Dim cn, cmd, rs, userRegInfoID
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open(strConnection)
Set cmd = Server.CreateObject("ADODB.Command")
Set cmd.ActiveConnection = cn
Set rs = Server.CreateObject("ADODB.Recordset")
Dim sql
sql = ""
Dim manangerEmail
manangerEmail = arrayUserRegInfo.Item("email_mananger")
if(NOT arrayUserRegInfo.Count = 16)then
cmd.CommandText = "lbg_UpdateUserRegInfo_ById"
cmd.CommandType = adCmdStoredProc
With cmd
.Parameters.Append .CreateParameter("@id_userreginfo", adVarChar, adParamInput, 50)
.Parameters("@id_userreginfo") = arrayUserRegInfo.Item("id_userreginfo")
.Parameters.Append .CreateParameter("@title", adVarChar, adParamInput, 50)
.Parameters("@title") = arrayUserRegInfo.Item("title")
.Parameters.Append .CreateParameter("@firstname", adVarChar, adParamInput, 50)
.Parameters("@firstname") = arrayUserRegInfo.Item("firstname")
.Parameters.Append .CreateParameter("@lastname", adVarChar, adParamInput, 50)
.Parameters("@lastname") = arrayUserRegInfo.Item("lastname")
.Parameters.Append .CreateParameter("@jobtitle", adVarChar, adParamInput, 50)
.Parameters("@jobtitle") = arrayUserRegInfo.Item("jobtitle")
.Parameters.Append .CreateParameter("@grade", adVarChar, adParamInput, 50)
.Parameters("@grade") = arrayUserRegInfo.Item("grade")
.Parameters.Append .CreateParameter("@division", adVarChar, adParamInput, 50)
.Parameters("@division") = arrayUserRegInfo.Item("division")
.Parameters.Append .CreateParameter("@department", adVarChar, adParamInput, 50)
.Parameters("@department") = arrayUserRegInfo.Item("department")
.Parameters.Append .CreateParameter("@communitybank", adInteger, adParamInput, 4)
.Parameters("@communitybank") = arrayUserRegInfo.Item("communitybank")
.Parameters.Append .CreateParameter("@personalcontactnumber", adVarChar, adParamInput, 50)
.Parameters("@personalcontactnumber") = arrayUserRegInfo.Item("personalcontactnumber")
.Parameters.Append .CreateParameter("@email", adVarChar, adParamInput, 75)
.Parameters("@email") = arrayUserRegInfo.Item("email")
.Parameters.Append .CreateParameter("@linemanagerfirstname", adVarChar, adParamInput, 50)
.Parameters("@linemanagerfirstname") = arrayUserRegInfo.Item("linemanagerfirstname")
.Parameters.Append .CreateParameter("@linemanagersurname", adVarChar, adParamInput, 50)
.Parameters("@linemanagersurname") = arrayUserRegInfo.Item("linemanagersurname")
.Parameters.Append .CreateParameter("@groupmanagerfirstname", adVarChar, adParamInput, 50)
.Parameters("@groupmanagerfirstname") = arrayUserRegInfo.Item("groupmanagerfirstname")
.Parameters.Append .CreateParameter("@groupmanagersurname", adVarChar, adParamInput, 50)
.Parameters("@groupmanagersurname") = arrayUserRegInfo.Item("groupmanagersurname")
Call Debugging_OutputDictionObj(arrayUserRegInfo, "db_UpdateUserRegInfo->arrayUserRegInfo")
.Parameters.Append .CreateParameter("@linked_manager_id", adInteger, adParamInput, 4)
.Parameters("@linked_manager_id") = arrayUserRegInfo.Item("linked_manager_id")
Response.Write "arrayUserRegInfo.Item(email_mananger) = " & arrayUserRegInfo.Item("email_mananger") & "<br>"
.Parameters.Append .CreateParameter("@email_mananger", adVarChar, adParamInput, 75)
.Parameters("@email_mananger") = manangerEmail
.Execute
End With
else
Response.Write "Error 008: Parameters missing<br>"
end if
cn.Close
Set cn = Nothing
Set cmd = Nothing
Set rs = Nothing
Response.End
db_CreateUserRegInfo = userRegInfoID
end function
它可能拼寫錯了,我們看不到?似乎並不像它曾經是email_mana * n * ger首先。 – 2013-04-29 14:08:17
什麼是@id_userreginfo ... – bummi 2013-04-29 14:11:36
謝謝Aaron。拼寫錯誤是我的形式,不是實際的ASP或SQL代碼,但提示仍然幫助我。我的表單使用id字段來知道哪個字段可以引用,並且我在幾天前更改了表單ID。 如果你把你的答案,我會勾選它,因爲它確實有幫助。 – 2013-04-29 15:28:52