combo isn't showing items bound from sql query

rgouette

Member
Joined
May 22, 2006
Messages
16
Location
Maine,USA
Programming Experience
1-3
Folks, I'm trying to:
1) drop a combo down, and base a SQL parameter on the selected value
2) do a SQL select,, and return a row of data to then...
3) bind that rows data to another combo in order to pick from the list of possible returns

Currently, I get nothing returned, but I know the select query is good, at least running from within SSMS
Am I going about this the right way(knowing there's 100 ways to do this)

Thanks lads,
rich




VB.NET:
     Public Sub bindSendingCombo()
        '-----------------------------------------------
        '   load SendTo destinations(returned from SQL)
        '   based on user(@sendingUserName)
        '-----------------------------------------------
        Dim strComboConnStringVMSQLRAD As String = "MY CONNECTION STRING"
        Dim mySqlConn As New SqlConnection(strComboConnStringVMSQLRAD)
        mySqlConn.Open()

        Dim mySqlQueryString = New String("select * from SiteCombo where site = @sendingUserName")
        Dim mySqlCommand As New SqlCommand(mySqlQueryString, mySqlConn)

        mySqlCommand.Parameters.AddWithValue("@sendingUserName", labelLocValue)
        Dim myDA As New SqlDataAdapter(mySqlCommand)
        Dim myComboDT As New DataTable
        myDA.Fill(myComboDT)
        mySqlConn.Close()
        cboLocation.DataSource = myComboDT
        cboLocation.DataMember = myComboDT.Columns(0).ColumnName
        cboLocation.DataBind()

    End Sub

This is the combo's asp code:
VB.NET:
 <asp:DropDownList ID="cboLocation" cssclass="PTdataEntry"  
            runat="server" Width="425px" 
            DataTextField="SITE" DataValueField="SITE" AutoPostBack="True">
            </asp:DropDownList>
 
Back
Top