Working, sorta...drop down list

Z

zamdrist

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
 
A

adi.jog

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
 
Z

zamdrist

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...
 
Z

zamdrist

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!
 
M

Mythran

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top