I have multiple dropdownlists each one filled with values from a specific column in the table. Also I have multiple textboxes corresponding to dropdownlists. For example, when I select an item from dropdownlistA, all the textboxes are filled with the first row values that contains that selected item and gives the number of rows containing this value……. In addition, I have 2 buttons one is Move Forward Button and the other is Move Previous…I am using a Record Set and don’t know how to move next and back throughout the selected rows…could you help me please? I am using a vb codebehind…
Part of the code:
I have 6 dropdownlists like the following,
Private Sub fillDropDownList3()
Dim sqlString As String = "select * from ItemName"
Dim cmd As New SqlCommand(sqlString, conn)
cmd.CommandType = CommandType.Text
Dim dr As SqlDataReader
conn.Open()
dr = cmd.ExecuteReader
While dr.Read
Me.DropDownList3.Items.Add(dr(0))
End While
dr.Close()
conn.Close()
Private Sub DropDownList3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DropDownList3.SelectedIndexChanged
Dim count As IntegerDim sqlString As String = " select * from ReceiptItems where ItemName=@ItemName"Dim cmd As New SqlCommand(sqlString, conn)
cmd.CommandType = CommandType.Text
cmd.Parameters.Add("@ItemName", Me.DropDownList3.SelectedItem.Text)
Dim dr As SqlDataReader
conn.Open()
dr = cmd.ExecuteReader
While dr.Read()
count = count + 1
Me.TextBox3.Text = dr("Name")
Me.TextBox4.Text = dr("Dept")
Me.TextBox5.Text = dr("ItemName")
Me.TextBox6.Text = dr("ItemDescription")
Me.TextBox7.Text = dr("ItemSN")
Me.TextBox8.Text = dr("Date")
End While
dr.Close()
conn.Close()
Me.TextBox2.Text = count
End Sub
but in the textbox corresponding to it, it just gives the first result. What I need is to know how to move to the next record, or get back to the previous one by clicking a button....
Thanks