Populate dropdown list

Discussion in 'ASP .Net' started by Mark Goldin, Jul 24, 2004.

  1. Mark Goldin

    Mark Goldin Guest

    How can I populate a dropdownlist with data from a database using
    Microsoft.ApplicationBlocks.Data ?
    Thanks
    Mark Goldin, Jul 24, 2004
    #1
    1. Advertising

  2. Use one of the SqlHelper methods. For instance, SqlHelper.ExecuteDataSet(.
    .. .), and then just map the DataSource = returnedDataSet.Tables[0];, and
    then you can set which field for the text and the value. All the
    applications blocks do is encapsulate the ado.net call, so instead of
    creating your connection object, then command object and executing the
    command to return something, you call a static method of SqlHelper passing
    in a connection string or connection or transaction object, the query or
    stored procedure to run, some other potential options, and you'll get a
    result back.

    I have wrapped the Data Access application block in my own class that, upon
    instantiation, creates a connection from the connection string stored in my
    config file, and then it's ready to exectue anything. On Dispose() of my
    object, I close my connection.

    Best regards,
    Jeffrey Palermo

    "Mark Goldin" <> wrote in message
    news:...
    > How can I populate a dropdownlist with data from a database using
    > Microsoft.ApplicationBlocks.Data ?
    > Thanks
    >
    >
    >
    >
    Jeffrey Palermo [MCP], Jul 26, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TWVyZGFhZA==?=

    How to populate dropdown list from database?

    =?Utf-8?B?TWVyZGFhZA==?=, Oct 20, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    10,378
    =?Utf-8?B?TWVyZGFhZA==?=
    Oct 20, 2004
  2. Jim via DotNetMonster.com

    Populate a dropdown list with a variable from a Querystring

    Jim via DotNetMonster.com, Feb 24, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    744
    Malik Asif Joyia
    Feb 24, 2005
  3. Vinay
    Replies:
    2
    Views:
    1,003
    Vinay
    Aug 18, 2005
  4. Steve Myers
    Replies:
    2
    Views:
    266
    Steve Myers
    Nov 20, 2003
  5. John Beschler

    Populate DropDown list at run-time

    John Beschler, Aug 11, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    550
    John Beschler
    Aug 12, 2005
Loading...

Share This Page