过程或函数需要参数",但未提供. [英] Procedure or function expects parameter', which was not supplied.
问题描述
我在尝试使用2个参数进行搜索时遇到问题,但出现错误提示:过程或函数"Learner_Existance"需要参数"@AccessionNo",但未提供.
这是我的商店商品...
I have a problem with my search im trying to search using 2 parameters but it giving meAN ERROR says : Procedure or function ''Learner_Existance'' expects parameter''@AccessionNo'', which was not supplied.
Here is my Store Proc...
create procedure [dbo].[Learner_Existance]
@EmisCode varchar(9),
@AccessionNo nvarchar(250)
AS
Select EmisCode,
AccessionNo,
Fname,
Sname,
Initials,
Gender,
Title ,
BirthDate ,
Religion,
Address1 ,
Address3 ,
AddressCode,
HomeLanguage ,
InstructionLanguage ,
PreferredLanguage ,
Race,
Citizenship,
PreviousSchoolProvince,
PreviousPlacementofSchool ,
PreviousSchool,
ProvinceResidence,
PhysProvince ,
Transport,
DeceasedParent,
LuritsNumber from Learner_Info
where EmisCode=@EmisCode
and AccessionNo = @AccessionNo
................................................... ................................
这是我的业务层
..................................................................................
Here My Business Layer
Public Function Get_Learner(ByVal Code As String, ByVal Num As String) As List(Of Learner)
Dim objDal As New csSQLDALVB
Dim objParList As New List(Of csParameterListType)
Dim objList As New List(Of Learner)
Dim dr As IDataReader
objParList.Add(New csParameterListType("@EmisCode", SqlDbType.VarChar, Code))
objParList.Add(New csParameterListType("@AccessionNo", SqlDbType.NVarChar, Num))
dr = objDal.executespreturndr("Learner_Existance", objParList)
Using dr
While dr.Read
Dim ll As New Learner
populate_reader(dr, ll)
objList.Add(ll)
End While
End Using
Return objList
End Function
................................................... ................................
和我的客户
..................................................................................
And My Client Side
Protected Sub btnsearch_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnsearch.Click
Dim objL As New Learner
Dim objlist As New List(Of Learner)
Dim code As String
Dim accesion As String
Try
objlist = objL.Get_Learner(txtEmiscode.Text, txtAccession.Text)
For Each ll As Learner In objlist
If objlist.Count <> 0 Then
code = ll.EmisCode
accesion = ll.AccessionNo
Response.Redirect("~/Emis_LearnerView.aspx" & "?EmisCode=" & code & "?AccessionNo=" & accesion)
Else
lblerror.Text = "cannot find student"
End If
Next
Catch ex As Exception
lblerror.Text = ex.Message
End Try
End Sub
End Class
请帮我快一个星期了.
please help me guys it almost a week now
推荐答案
检查空参数,如果是,请使用DBNull.另外,请查看此链接:
http://dhondiyals.wordpress .com/2011/05/05/procedure-or-function-expects-parameter-which-was-not-supplied-resolved/ [
Check for null parameters and if so use DBNull instead. Also, check out this link:
http://dhondiyals.wordpress.com/2011/05/05/procedure-or-function-expects-parameter-which-was-not-supplied-resolved/[^]
Good luck!
这篇关于过程或函数需要参数",但未提供.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!