Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 drop down not filling up

Author  Topic 

jhermiz

3564 Posts

Posted - 2004-09-16 : 10:10:23
errr...
vb.net is driving me nutz .

Need to fill a drop down list...

Tried this but the page shows but the combo box is empty and I am certain there are records in the table:


Sub Page_Load(src as Object, e As EventArgs)
If Not IsPostBack then
LoadClients()
end if
End Sub

Sub LoadClients()
Dim conMyData As SqlConnection
Dim cmdSelect As SqlCommand
Dim reader as SqlDataReader
'try and make a connection
Try
conMyData = New SqlConnection( ConfigurationSettings.AppSettings("strConn") )
cmdSelect = New SqlCommand( "select_clients", conMyData )
cmdSelect.CommandType = CommandType.StoredProcedure
conMyData.Open()

reader = cmdSelect.ExecuteReader()

ddlClient.DataSource = reader
ddlClient.DataTextField = "Client"
ddlClient.DataValueField= "ClientID"
ddlClient.DataBind()
'catch any exceptions that might be thrown
Catch e as Exception
Response.Write("An Error Occurred: " & e.toString())
'clean up and close resources
Finally
conMyData.Close()
End Try

End Sub


Also I set breakpoints and tried for the life of me to step through code, I noticed you cant, or can ya ? If so how ? The first break point hits when the page loads but u cant step through the code ?


Jon
www.web-impulse.com

Can you dig it: http://www.thecenturoncompany.com/jhermiz/blog/

jhermiz

3564 Posts

Posted - 2004-09-16 : 17:05:16


nevermind suddenly it works

Jon
www.web-impulse.com

Can you dig it: http://www.thecenturoncompany.com/jhermiz/blog/
Go to Top of Page
   

- Advertisement -