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!
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