Hi Folks
Working on a VB 2008 app with SQL Server Express 2008 R2 back end. I have the following code I'm using to call a stored proc in SQL Server that takes one parameter, @Par1, which is a character value. The Value of Param1 (being passed in at the top of the function is "HO" (could be any two-letter combination).
When I try to run this the call seems to be finding the SP just fine, but it tells me that "Procedure or function '<proc Name>' expects parameter '@Par1', which was not supplied." You can see plainly below that it is, in fact, being sent.
I've tried this as both an added parameter on the SQLCommand object and on the SQLDataAdapter, results are the same. Any ide why this might be happening to me?
Craig
Amesville
Working on a VB 2008 app with SQL Server Express 2008 R2 back end. I have the following code I'm using to call a stored proc in SQL Server that takes one parameter, @Par1, which is a character value. The Value of Param1 (being passed in at the top of the function is "HO" (could be any two-letter combination).
When I try to run this the call seems to be finding the SP just fine, but it tells me that "Procedure or function '<proc Name>' expects parameter '@Par1', which was not supplied." You can see plainly below that it is, in fact, being sent.
Code:
Public Function FillDtSp1(ByVal ProcName As String, ByVal Param1 As String) As DataTable
Dim dcLk As New SqlCommand(ProcName, cnHTT)
Dim daFillDt As New SqlDataAdapter(dcLk)
daFillDt.SelectCommand.Parameters.Add("@Par1", SqlDbType.Char, (40)).Value = Param1
Dim dt1 As New DataTable
If cnHTT.State <> ConnectionState.Open Then cnHTT.Open()
daFillDt.Fill(dt1)
If cnHTT.State <> ConnectionState.Closed Then cnHTT.Close()
Return dt1
End Function
I've tried this as both an added parameter on the SQLCommand object and on the SQLDataAdapter, results are the same. Any ide why this might be happening to me?
Craig
Amesville