Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2003
    Posts
    8

    Smile Unanswered: Populating a Datalist control

    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

  2. #2
    Join Date
    Feb 2003
    Location
    Montreal, Canada
    Posts
    117

    Re: Populating a Datalist control

    Just take out the following line and it should work...

    Set DataList1.DataSource = AdoRoles


    Originally posted by sgskumar
    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
    Steve

  3. #3
    Join Date
    Jun 2003
    Posts
    8

    Red face Re: Populating a Datalist control

    Originally posted by dbadelphes
    Just take out the following line and it should work...

    Set DataList1.DataSource = AdoRoles
    I tried that, didnt work. The datalist is still empty.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •