Working, sorta...drop down list

Discussion in 'ASP .Net Web Controls' started by zamdrist@gmail.com, Dec 14, 2005.

  1. Guest

    I have an ASPX codebehind webform with two drop down lists. The first
    code below gets data and populates the ddl. The second (ddlGroups)
    fails and I cannot figure out why. I checked the permissions of the
    stored procedure, even ran it via query analyzer.

    Although I haven't figured out how to turn debugging on, by process of
    elimination I believe it's the line .DataSource=...in the second With,
    End With that appears to be failing with a runtime error. The first
    works splendidly.

    Any thoughts, ideas? Thanks...

    Dim adoComm_Attorney As New
    SqlCommand("sp_UTL_MGProlawContacts_GetAttorneyCategories", adoConn)

    With ddlAttorney
    .DataSource = adoComm_Attorney.ExecuteReader()
    .DataTextField = "Category"
    .DataValueField = "Category"
    .DataValueField = "Category"
    .DataBind()
    End With


    Dim adoComm_Groups As New
    SqlCommand("sp_UTL_MGProlawContacts_GetGroups", adoConn)

    With ddlGroups
    .DataSource = adoComm_Groups.ExecuteReader()
    .DataTextField = "CategoryGroup"
    .DataValueField = "CategoryGroup"
    .DataBind()
    End With
    , Dec 14, 2005
    #1
    1. Advertising

  2. Guest

    Close the first reader before the second ExecuteReader,
    since you are executing both the readers on the same connection.

    In the future, remember it's easier to answer a question if you provide
    the actual error message instead of a generic "appears to be failing
    with a runtime error"

    hope this helps
    , Dec 14, 2005
    #2
    1. Advertising

  3. Guest

    Like this?

    adoComm_Attorney.ExecuteReader.Close()

    Unfortunately, because debugging isn't configured correctly via ASP.Net
    & the web server, all I do get is 'runtime error' and no real
    explanation of what the actual error is. I wish I could give you more
    info, but I've never been able to get asp.net debugging to work.

    Closing the reader as I did above unfortunately only returns runtime
    error...again :(

    Thanks...
    wrote:
    > Close the first reader before the second ExecuteReader,
    > since you are executing both the readers on the same connection.
    >
    > In the future, remember it's easier to answer a question if you provide
    > the actual error message instead of a generic "appears to be failing
    > with a runtime error"
    >
    > hope this helps
    , Dec 14, 2005
    #3
  4. Guest

    I figured out, I needed to define a SQLDataReader variable.

    ..
    ..
    ..
    Dim GroupReader As SqlDataReader
    GroupReader = adoComm_Groups.ExecuteReader
    ..
    ..
    ..
    GroupReader.Close()

    Thanks for pointing me in the right direction!
    , Dec 14, 2005
    #4
  5. Mythran Guest

    <> wrote in message
    news:...
    >I figured out, I needed to define a SQLDataReader variable.
    >
    > .
    > .
    > .
    > Dim GroupReader As SqlDataReader
    > GroupReader = adoComm_Groups.ExecuteReader
    > .
    > .
    > .
    > GroupReader.Close()
    >
    > Thanks for pointing me in the right direction!
    >


    Yay, now that it works...let's work on another one of your
    problems...getting ASP.Net Debugging to work :)

    When you try to start with debugging, do you get an error? If so, open the
    MSDN library and enter this in the address bar for it:

    ms-help://MS.MSDNQTR.2003FEB.1033/vsdebug/html/vxtbsHTTPServerErrors.htm

    This has several solutions to some common problems with setting up ASP.Net
    debugging :)

    If you still have trouble, let us know :)

    Mythran
    Mythran, Dec 15, 2005
    #5
    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. SirPoonga
    Replies:
    2
    Views:
    759
    Ben Strackany
    Jan 7, 2005
  2. weiwei
    Replies:
    0
    Views:
    1,014
    weiwei
    Jan 5, 2007
  3. msimmons
    Replies:
    0
    Views:
    473
    msimmons
    Jul 16, 2009
  4. Replies:
    5
    Views:
    267
  5. Replies:
    3
    Views:
    285
Loading...

Share This Page