1 Replies - 3055 Views - Last Post: 12 September 2012 - 08:59 AM Rate Topic: -----

#1 sawer2  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 26
  • Joined: 18-August 09

Problem with showing data in ListView From the Database

Posted 09 September 2012 - 12:51 PM

Hello everyone ...!!

I'm having a problem with my ListView .. !! the problem is that when i try to show the data from the database it will show only the first column .. !! and i will get this error " Type Mismatch error " 13 " , I don't know what is the problem .. (( the version im using is windows common controls SP6 ))But when i use an older version of the listview (like SP5) it will be shown correctly ... Here is my code that im using to show the data !! :

Private sub ShowList()
Rs.Open "select * from tblDonors ", Cn, adOpenStatic, adLockOptimistic
With ListView1
.FullRowSelect = True
.View = lvwReport
.ColumnHeaders.Clear
.ColumnHeaders.Add , , "Barcode Number", 2000
.ColumnHeaders.Add , , "ID Number", 2000
.ColumnHeaders.Add , , "Name", 2000
.ColumnHeaders.Add , , "Gender", 2000
.ColumnHeaders.Add , , "Nationality", 2000
.ColumnHeaders.Add , , "D.O.B", 2000
.ColumnHeaders.Add , , "Address", 2000
.ColumnHeaders.Add , , "City", 2000
.ColumnHeaders.Add , , "ABO", 2000
.ColumnHeaders.Add , , "Age", 2000
.ColumnHeaders.Add , , "Phone", 2000
.ListItems.Clear

Do While Not Rs.EOF
Set SRC_ITEM = .ListItems.Add(, , Rs.Fields("barcode_no"))
SRC_ITEM.SubItems(1) = Rs.Fields("id_no")
SRC_ITEM.SubItems(2) = Rs.Fields("dname")
SRC_ITEM.SubItems(3) = Rs.Fields("gender")
SRC_ITEM.SubItems(4) = Rs.Fields("nationality")
SRC_ITEM.SubItems(5) = Rs.Fields("dob")
SRC_ITEM.SubItems(6) = Rs.Fields("address")
SRC_ITEM.SubItems(7) = Rs.Fields("city")
SRC_ITEM.SubItems(8) = Rs.Fields("dbgroup")
SRC_ITEM.SubItems(9) = Rs.Fields("age")
SRC_ITEM.SubItems(10) = Rs.Fields("phone")
Rs.MoveNext
Loop
End With
End Sub





I tried my best , But really I cant find any solution for it.

hope anyone can help me.

:)

best regards.

Is This A Good Question/Topic? 0
  • +

Replies To: Problem with showing data in ListView From the Database

#2 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: Problem with showing data in ListView From the Database

Posted 12 September 2012 - 08:59 AM

What line of code causes the error?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1