hisheeraz
Member
- Joined
- Oct 5, 2008
- Messages
- 11
- Programming Experience
- 1-3
hey guys
i am having trouble loading data into listview from access database
here is the error im getting
any help would be much appreciated.
thanks
shiraz
i am having trouble loading data into listview from access database
VB.NET:
Try
Dim iForLoop As Integer
Dim ds As DataSet
Dim da As System.Data.OleDb.OleDbDataAdapter
sql = "SELECT * FROM tblRoster"
da = New OleDb.OleDbDataAdapter(sql, con)
ds = New DataSet
da.Fill(ds, "tblRoster")
sqlR_Count = ds.Tables(0).Rows.Count
For iForLoop = 1 To sqlR_Count-1
Dim new_item = New ListViewItem
'im getting error on below inw
new_item = (ds.Tables("tblRoster").Rows(iForLoop)("eDate"))
lvViewRoster.Items.Add(new_item)
Next iForLoop
Catch ex As Exception
MsgBox(ex.ToString)
End Try
here is the error im getting
VB.NET:
Unable to cast object of type 'System.String' to type 'System.Windows.Forms.ListViewItem'.
any help would be much appreciated.
thanks
shiraz