all groups > asp.net webcontrols > december 2005 >
You're in the

asp.net webcontrols

group:

Working, sorta...drop down list


Working, sorta...drop down list zamdrist NO[at]SPAM gmail.com
12/14/2005 12:46:48 PM
asp.net webcontrols:
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
Re: Working, sorta...drop down list adi.jog NO[at]SPAM gmail.com
12/14/2005 12:51:26 PM
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
Re: Working, sorta...drop down list zamdrist NO[at]SPAM gmail.com
12/14/2005 12:59:48 PM
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...
[quoted text, click to view]
Re: Working, sorta...drop down list zamdrist NO[at]SPAM gmail.com
12/14/2005 1:17:54 PM
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!
Re: Working, sorta...drop down list Mythran
12/15/2005 8:35:52 AM

[quoted text, click to view]

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
AddThis Social Bookmark Button