Hello,
I am trying to create a drop down list that is populated by a database. I have down this many times before with no problems what so ever, but this time I am getting the following text in my dropdown list:
System.Data.Common.DbDatarecord
The code I am using is:
Dim Conn As SqlConnection
'SQL Connection for datagrid
'Dim SQLCommand1 As SqlCommand
Dim DataReader As SQlDataReader
Dim GetCostCenterSQL as String
'Create a connection to database
Conn = New SqlConnection(dbconstr)
'connection to the database
conn.open()
GetCostCenterSQL = myquery
Dim SQLCommand1 as SQlCommand = new SqlCommand GetCostCenterSQL, Conn)
DataReader = SQLCommand1.ExecuteReader(CommandBehavior.CloseConnection)
Ddl_CostCenter.DataSource = DataReader
Ddl_CostCenter.DataBind()
I cant see any problems with my code at all..but I'm guessing there is something very simple wrong!
Cheers,
NEil
I am trying to create a drop down list that is populated by a database. I have down this many times before with no problems what so ever, but this time I am getting the following text in my dropdown list:
System.Data.Common.DbDatarecord
The code I am using is:
Dim Conn As SqlConnection
'SQL Connection for datagrid
'Dim SQLCommand1 As SqlCommand
Dim DataReader As SQlDataReader
Dim GetCostCenterSQL as String
'Create a connection to database
Conn = New SqlConnection(dbconstr)
'connection to the database
conn.open()
GetCostCenterSQL = myquery
Dim SQLCommand1 as SQlCommand = new SqlCommand GetCostCenterSQL, Conn)
DataReader = SQLCommand1.ExecuteReader(CommandBehavior.CloseConnection)
Ddl_CostCenter.DataSource = DataReader
Ddl_CostCenter.DataBind()
I cant see any problems with my code at all..but I'm guessing there is something very simple wrong!
Cheers,
NEil