Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2004
    Posts
    2

    Exclamation Unanswered: Procedure 'list_Docs' expects parameter '@EmployeeID', which was not supplied.

    I am trying to set up my drop down boxes so that once someone selects their name from the employees (or authors) list and clicks a button called find my documents, it will populate the documents list. Here is my page code so far:
    ublic Class WebForm7
    Inherits System.Web.UI.Page

    #Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    Me.SqlConnection2 = New System.Data.SqlClient.SqlConnection
    Me.SqlDataAdapter2 = New System.Data.SqlClient.SqlDataAdapter
    Me.SqlSelectCommand2 = New System.Data.SqlClient.SqlCommand
    Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter
    Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand
    '
    'SqlConnection2
    '
    Me.SqlConnection2.ConnectionString = "workstation id=DAVIDSON8PC;packet size=4096;user id=intern;data source=ADMINSQL;p" & _
    "ersist security info=True;initial catalog=Budget_Testing;password=tunvei4"
    '
    'SqlDataAdapter2
    '
    Me.SqlDataAdapter2.SelectCommand = Me.SqlSelectCommand2
    Me.SqlDataAdapter2.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "dbo_List_employees", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("EmployeeID", "EmployeeID"), New System.Data.Common.DataColumnMapping("EmpName", "EmpName")})})
    '
    'SqlSelectCommand2
    '
    Me.SqlSelectCommand2.CommandText = "dbo.[List_employees]"
    Me.SqlSelectCommand2.CommandType = System.Data.CommandType.StoredProcedure
    Me.SqlSelectCommand2.Connection = Me.SqlConnection2
    Me.SqlSelectCommand2.Parameters.Add(New System.Data.SqlClient.SqlParameter("@RETURN_VALUE" , System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, False, CType(0, Byte), CType(0, Byte), "", System.Data.DataRowVersion.Current, Nothing))
    '
    'SqlDataAdapter1
    '
    Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1
    Me.SqlDataAdapter1.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "dbo_list_Docs", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("DocID", "DocID"), New System.Data.Common.DataColumnMapping("DocInfo", "DocInfo")})})
    '
    'SqlSelectCommand1
    '
    Me.SqlSelectCommand1.CommandText = "dbo.[list_Docs]"
    Me.SqlSelectCommand1.CommandType = System.Data.CommandType.StoredProcedure
    Me.SqlSelectCommand1.Connection = Me.SqlConnection2
    Me.SqlSelectCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@EmployeeID", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, False, CType(0, Byte), CType(0, Byte), "", System.Data.DataRowVersion.Current, Nothing))
    Me.SqlSelectCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@EmployeeID", System.Data.SqlDbType.Int, 4))

    End Sub
    Protected WithEvents Main As System.Web.UI.WebControls.Label
    Protected WithEvents Warning As System.Web.UI.WebControls.Label
    Protected WithEvents File_ver As System.Web.UI.WebControls.Label
    Protected WithEvents File1 As System.Web.UI.HtmlControls.HtmlInputFile
    Protected WithEvents Doc_List As System.Web.UI.WebControls.DropDownList
    Protected WithEvents Document As System.Web.UI.WebControls.Label
    Protected WithEvents Author_vers As System.Web.UI.WebControls.DropDownList
    Protected WithEvents Author As System.Web.UI.WebControls.Label
    Protected WithEvents Upload As System.Web.UI.WebControls.Button
    Protected WithEvents SqlConnection2 As System.Data.SqlClient.SqlConnection
    Protected WithEvents SqlDataAdapter2 As System.Data.SqlClient.SqlDataAdapter
    Protected WithEvents SqlSelectCommand2 As System.Data.SqlClient.SqlCommand
    Protected WithEvents Button1 As System.Web.UI.WebControls.Button
    Protected WithEvents SqlDataAdapter1 As System.Data.SqlClient.SqlDataAdapter
    Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    'CODEGEN: This method call is required by the Web Form Designer
    'Do not modify it using the code editor.
    InitializeComponent()
    End Sub

    #End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here
    Dim ds As New DataSet
    SqlDataAdapter2.Fill(ds)
    Author_vers.DataSource = ds
    Author_vers.DataBind()




    End Sub

    Private Sub Author_vers_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Author_vers.SelectedIndexChanged
    'Dim ds1 As New DataSet

    'Me.SqlDataAdapter1.SelectCommand.Parameters.Add(" @EmployeeID", SqlDbType.Int, 4) '
    ''Dim param As SqlClient.SqlParameter = SqlSelectCommand1.Parameters.Item("@EmployeeID").V alue = Author_vers.SelectedValue
    'SqlSelectCommand1.Parameters.Item("@EmployeeID"). Value = Author_vers.SelectedValue

    'SqlDataAdapter1.Fill(ds1)
    'Doc_List.DataSource = ds1
    'Doc_List.DataBind()




    End Sub

    Private Sub SqlConnection2_InfoMessage(ByVal sender As System.Object, ByVal e As System.Data.SqlClient.SqlInfoMessageEventArgs) Handles SqlConnection2.InfoMessage

    End Sub

    Private Sub SqlDataAdapter2_RowUpdated(ByVal sender As System.Object, ByVal e As System.Data.SqlClient.SqlRowUpdatedEventArgs) Handles SqlDataAdapter2.RowUpdated

    End Sub

    Private Sub SqlDataAdapter1_RowUpdated(ByVal sender As System.Object, ByVal e As System.Data.SqlClient.SqlRowUpdatedEventArgs)

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim ds1 As New DataSet


    'SqlSelectCommand1.Parameters.Add("@EmployeeID", SqlDbType.Int, 4)
    ''Dim param As SqlClient.SqlParameter = SqlSelectCommand1.Parameters.Item("@EmployeeID").V alue = Author_vers.SelectedValue
    ''SqlSelectCommand1.Parameters.Add("@EmployeeID", SqlDbType.Int, 4)
    SqlSelectCommand1.Parameters.Item("@EmployeeID").V alue = Author_vers.SelectedValue
    SqlDataAdapter1.Fill(ds1)
    Doc_List.DataSource = ds1
    Doc_List.DataBind()


    End Sub

    Private Sub Upload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Upload.Click
    'Dim create_Version As SqlClient.SqlCommand
    'create_Version = New SqlClient.SqlCommand
    'create_Version.CommandType = CommandType.StoredProcedure
    'create_Version.CommandText = "create_Version"
    'create_Version.Connection = SqlConnection2

    'Dim emp_param As SqlClient.SqlParameter
    'emp_param = New SqlClient.SqlParameter
    'emp_param.ParameterName = "@EmployeeID"
    'emp_param.SqlDbType = SqlDbType.Int
    'create_Version.Parameters.Add(emp_param)

    'Dim doc_param As SqlClient.SqlParameter
    'doc_param = New SqlClient.SqlParameter
    'doc_param.ParameterName = "@DocID"
    'doc_param.SqlDbType = SqlDbType.VarChar
    'create_Version.Parameters.Add(doc_param)
    End Sub
    End Class
    My stored procedures are as follows:
    CREATE PROCEDURE dbo.[list_employees] AS

    select EmployeeID, LastName + ', ' + FirstName as EmpName
    from Employee
    GO

    CREATE PROCEDURE dbo.[list_Docs]

    @EmployeeID INT

    AS
    SET NOCOUNT ON


    SELECT
    Version.DocID,
    [FileName] + '-' + CAST(ReviseDate AS VARCHAR) as DocInfo
    FROM
    dbo.Version, dbo.DocSys

    WHERE
    EmployeeID = @EmployeeID
    AND
    (
    Version.DocID = DocSys.DocID --OR
    --@EmployeeID = -1
    )

    ORDER BY
    [FileName]
    GO

    Could someone please tell me why I get the error: Procedure 'list_Docs' expects parameter '@EmployeeID', which was not supplied.

  2. #2
    Join Date
    Apr 2004
    Posts
    2

    Note:

    I am doing this in Visual Basic with ASP.Net

Posting Permissions

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