datagrid problem

williamLOR

Member
Joined
Aug 3, 2005
Messages
9
Programming Experience
Beginner
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.
 
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.
 
jmcilhinney said:
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
 
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
 
Back
Top