Drop Down List - (DDL) RRS feed

  • Question

  • Hi All,


    I am new to ASP.Net. I have a question. How can I have a DDL, when selected, pull in a single record from a database. The code below works because it is hard coded. How can I do the same w/out hard coding? Thanks,



    Protected Sub ddlBusName_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlBusName.SelectedIndexChanged


    Dim ***** As String = "Data Source=(DESCRIPTION=(ADDRESS_LIST=" _


    "(ADDRESS=(PROTOCOL=*****)(HOST=*********)(PORT=******)))" _


    "(CONNECT_DATA=(SERVER=*******)(SERVICE_NAME=*******)));" _


    "User Id=*******;Password=*******;"


    Dim conn As New OracleConnection(*****)

     Dim ds As New DataSet()



    ddlBusName.SelectedValue = "Aliceville Wolverines"



    Dim sql As String

    sql =

    "SELECT Bus_ID_Num, Bus_Name, Dscr FROM GZBJLD_BUSINESS_INFO where bus_name = 'Aliceville Wolverines'"


    Dim dataadapter As New OracleDataAdapter(sql, conn)



    GridView1.DataSource = ds.Tables(



    GridView1.DataMember =





    End If
    • Moved by edhickey Thursday, May 5, 2011 10:19 PM (From:.NET 3.0/3.5 Windows Workflow Foundation)
    Thursday, May 5, 2011 4:44 PM


All replies

  • Hi,


    You posted this in a Windows Workflow forum, so we don't have the expertise here to answer you.  Please ask this over at http://forums.asp.net so that you will reach a more relevant set of experts and you can get an answer to your question.



    Ed Hickey http://blogs.msdn.com/b/edhickey/archive/2010/04/21/how-to-post-effectively-in-forums.aspx
    Thursday, May 5, 2011 10:19 PM
  • Sorry...Thanks.

    • Marked as answer by Simba_4 Wednesday, May 11, 2011 7:06 PM
    Friday, May 6, 2011 1:21 PM