Results 1 to 5 of 5

Thread: datagrid problem

  1. #1
    williamLOR is offline VB.NET Forum Newbie
    .NET Framework
    Join Date
    Aug 2005
    Posts
    9
    Reputation
    0

    datagrid problem

    Dear fren here,

    I'm doing the search form now.when i want to search user name.
    it prompt out the error as below:

    An SqlParameter with ParameterName '@Employee_ID' is not contained by this SqlParameterCollection.

    i create a dataadapter, dataset, and my data fill in data grid.

  2. #2
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    11,346
    Reputation
    1543
    You have specified a parameter name @Employee_ID in your SQL statement but you have not added a parameter of that name to the SqlCommand object you are using. The command will be in the SelectCommand property of your SqlDataAdapter.

  3. #3
    williamLOR is offline VB.NET Forum Newbie
    .NET Framework
    Join Date
    Aug 2005
    Posts
    9
    Reputation
    0
    Quote Originally Posted by jmcilhinney
    You have specified a parameter name @Employee_ID in your SQL statement but you have not added a parameter of that name to the SqlCommand object you are using. The command will be in the SelectCommand property of your SqlDataAdapter.
    thanks ..get it

  4. #4
    williamLOR is offline VB.NET Forum Newbie
    .NET Framework
    Join Date
    Aug 2005
    Posts
    9
    Reputation
    0
    that part i had solved.


    another issue come out, when i click select in datagrid .
    it should pass all my value to edit form for editing.
    when it redirect to edit form. the value didn't pass in it.

    how come ?


    Search form:

    Private Sub DGApproval1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles DGApproval1.ItemCommand
    If e.CommandName = "Select" Then
    Session("ID") = DGApproval1.Items(e.Item.ItemIndex).Cells(0).Text
    Session("Name") = DGApproval1.Items(e.Item.ItemIndex).Cells(1).Text
    Session("Department") = DGApproval1.Items(e.Item.ItemIndex).Cell(2).Text
    Session("Branch") = DGApproval1.Items(e.Item.ItemIndex).Cells(3).Text
    Session("Subsidiary") = DGApproval1.Items(e.Item.ItemIndex).Cells(4).Text
    Response.Redirect("Approval1.aspx")
    End If
    End Sub

    edit form

    Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

    If Not IsPostBack Then
    txtID.Text = Session("ID")
    txtName.Text = Session("Name")
    txtDepartment.Text = Session("Department")
    txtBranch.Text = Session("Branch")
    txtSubsidiary.Text = Session("Subsidiary")

    End If
    End Sub

  5. #5
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    11,346
    Reputation
    1543
    That's an ASP.NET question so I'd recommend you post it in the ASP.NET forum. The folks there are more likely to know the answer.

Bookmarks

Posting Permissions

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