R
Rob Venable
Hi everyone,
Can anyone see a problem with this code. I'm kinda new to asp.net and
I'm having a problem populating a drop down list with a database query.
The results of my query populate the list with the words
"System.Data.Common.DbDataRecord"
This is my code:
If Not Page.IsPostBack Then
Dim cn As New
SqlConnection(ConfigurationSettings.AppSettings("CONN_STRING"))
Dim sql As String = "SELECT * FROM teams "
Dim dr As SqlDataReader
Dim cmd As New SqlCommand(sql, cn)
cn.Open()
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
ddlTeam.DataSource = dr
ddlTeam.DataBind()
cn.Close()
End If
Any help would be greatly appreciated.
Thanks
Rob
Can anyone see a problem with this code. I'm kinda new to asp.net and
I'm having a problem populating a drop down list with a database query.
The results of my query populate the list with the words
"System.Data.Common.DbDataRecord"
This is my code:
If Not Page.IsPostBack Then
Dim cn As New
SqlConnection(ConfigurationSettings.AppSettings("CONN_STRING"))
Dim sql As String = "SELECT * FROM teams "
Dim dr As SqlDataReader
Dim cmd As New SqlCommand(sql, cn)
cn.Open()
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
ddlTeam.DataSource = dr
ddlTeam.DataBind()
cn.Close()
End If
Any help would be greatly appreciated.
Thanks
Rob