Results 1 to 2 of 2

Thread: Populating ListView from SQCe

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2013
    Posts
    74

    Populating ListView from SQCe

    Im using this code to populate my datagrid from my SQLCe database, is it possible to use mydataset to populate a listview control?

    Code:
    Public Sub showdatabase()
            cmd = New SqlCeCommand("Select * from Table001", con)
            If con.State = ConnectionState.Closed Then con.Open()
            myda = New SqlCeDataAdapter(cmd)
            mydataset = New DataSet()
            myda.Fill(mydataset, "Table")
            DataGrid1.DataSource = mydataset.Tables("Table").DefaultView
    
            TextBox2.Text = mydataset.Tables("Table").Rows.Count
            cmd.Dispose()
            con.Close()
        End Sub
    if its not possible, can someone show me on how to populate a listview with SQLCe database? Thanks!

  2. #2
    ASP.NET Moderator gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Populating ListView from SQCe

    Rather than using a DataSet, I would probably manually "walk" the resultset from the Database, and create a List of objects that represent the items in my database, i.e. create a Business Logic Layer. From there, I would then add these BLL objects to the ListView, when required.

    Gary

Posting Permissions

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



Click Here to Expand Forum to Full Width