Hi,
I am trying to populate a datalist control with the data in the sql server. Below is the code :
Public con As New ADODB.Connection
Public AdoRoles As New ADODB.Recordset
con.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=name;Password=password;Initial Catalog=Spotlight;Data Source=SQL"
AdoRoles.Open "SELECT RoleType FROM Role ORDER BY RoleType", con
Set DataList1.DataSource = AdoRoles
Set DataList1.RowSource = AdoRoles
DataList1.DataField = RoleType
DataList1.ListField = RoleType
DataList1.Refresh
The Problem is when I run the code the datalist control is empty. I dont know what I am doing wrong. Please help me.
Thanks