I am creating function searching on my web with drop down list, text box and button search. The following code:

<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true"
     <asp:ListItem Value="Pelanggan Rumah"></asp:ListItem>
     <asp:ListItem Value="Meter Besar"></asp:ListItem>
     <asp:ListItem Value="Kios Air"></asp:ListItem>
     <asp:ListItem Value="Pipa"></asp:ListItem>
     <asp:ListItem Value="Pembayaran"></asp:ListItem>
<asp:TextBox ID="CariText" runat="server" Width="100px" Height="23px" CssClass="text_boxt_search"></asp:TextBox>
<asp:Button ID="Find" runat="server" Text="Search" Width="61px" CssClass="style105"  Height="25px" />

And this is code behind:

Public Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
        Dim strConnect As String = Nothing
        strConnect = Session("Data Source=;Initial Catalog=ATBGISMAPDB;Persist Security Info=True;User ID=gis;Password=Pa5word@tb")

        Dim a As String = "SqlDataSourceCustomer" 'datasourceID'
        Dim b As String = "SqlDataSourceTank" 'datasourceID'
        Dim c As String = "SqlDataSourceKiosk" 'datasourceID'
        Dim d As String = "SqlDataSourcePipa" 'datasourceID'

        If DropDownList1.SelectedItem.Value = a Then
            Query = "SELECT * FROM DBCUSTOMER where a = '" & LabelDDL.Text & "'"
        ElseIf DropDownList1.SelectedItem.Value = b Then
            Query = "SELECT * FROM METER_MAIN where b = '" & LabelDDL.Text & "'"
        ElseIf DropDownList1.SelectedItem.Value = c Then
            Query = "SELECT * FROM KIOSK where c = '" & LabelDDL.Text & "'"
        ElseIf DropDownList1.SelectedItem.Value = d Then
            Query = "SELECT * FROM PIPELINE_NEW where d = '" & LabelDDL.Text & "'"
        End If
    End Sub

But, with above code the function not running yet. Can anyone help me?
'sorry for my english'

6 Years
Discussion Span
Last Post by geniusvishal
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.