compiler not recognizing sqlParameter

Results 1 to 3 of 3

Thread: compiler not recognizing sqlParameter

  1. #1
    Join Date
    Dec 1969
    Posts
    17

    Default compiler not recognizing sqlParameter

    I would really appreciate help with this!<BR>I wrote a sp that needs a parm passed to it.<BR><BR>here&#039;s the first line of the sp<BR>ALTER PROCEDURE dbo.spSelectTeachersBySchools (@vSchoolList nvarchar(80))<BR><BR>here is calling function:<BR>Public Function GetTeacherBySchool() As DataView<BR> Dim DS As DataSet<BR> Dim MyConnection As SqlConnection<BR> Dim MyCommand As SqlDataAdapter<BR> <BR> MyConnection = New SqlConnection(GetData.ConnectionString)<BR> MyCommand = New SqlDataAdapter("spSelectTeachersBySchools", MyConnection)<BR> MyCommand.SelectCommand.CommandType = CommandType.StoredProcedure<BR> MyCommand.SelectCommand.Parameters.Add(New SqlParameter("@vSchoolList", SqlDbType.NVarChar, 80))<BR> MyCommand.SelectCommand.Parameters("@vSchoolList") .Value = sSchoolList<BR><BR> DS = New DataSet()<BR> MyCommand.Fill(DS, "Teachers")<BR><BR> Return DS.Tables("Teachers").DefaultView<BR><BR> End Function<BR><BR>Here is the message I am getting when I try to load the page:<BR>Procedure &#039;spSelectTeachersBySchools&#039; expects parameter &#039;@vSchoolList&#039;, which was not supplied.<BR><BR>Anyone know why this might be happening?<BR><BR>thanks so much

  2. #2

    Default RE: compiler not recognizing sqlParameter

    Thats not a compiler error, it is a run-time error.<BR>Examine the # and order of your parameters in the SP.<BR>Make sure they match the code.<BR><BR>You are using SQL Server, why not use Microsoft.ApplicationBlocks.Data ?<BR>You can find it on MSDN

  3. #3
    Join Date
    Dec 1969
    Posts
    17

    Default RE: compiler not recognizing sqlParameter

    I thought I was a complier error because that code doesn&#039;t run until a button is clicked. I found the error to be a problem with the property I was using to set the value. I got this one fixed. thanks for your help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •