|
-
Jan 23rd, 2006, 10:07 PM
#1
Thread Starter
Lively Member
using 2 database for Listview function
if i need to link two database to one listview, i had written the following but it doesn't seems to work. can someone help me out with this??
The subrecordset doesn't seems to able to extract data from database
Dim sqlstring As String
Dim sqlstring2 As String
sqlstring = "SELECT * FROM APPOINTMENT_T WHERE APPOINTMENT_DATE = #" & Apptdate2 & "# ORDER BY APPOINTMENT_DATE, START_TIME"
mainRecordset.Open sqlstring, mainConnection, adOpenKeyset, _
adLockOptimistic, adCmdText
If mainRecordset.RecordCount <> 0 Then
mainRecordset.MoveFirst
IC.Text = mainRecordset.Fields("PATIENT_ID").Value
sqlstring2 = "SELECT * FROM PATIENT_RECORD_T WHERE NRIC = '" + IC.Text + "' "
subrecordset.Open sqlstring, mainConnection, adOpenKeyset, _
adLockOptimistic, adCmdText
Do While Not mainRecordset.EOF
If mainRecordset.RecordCount <> 0 And subrecordset.RecordCount <> 0 Then
subrecordset.MoveFirst
With ListView
With ListView.ListItems.Add(, , Format(mainRecordset.Fields("PATIENT_ID").Value, "dd-mmm-yy"))
.SubItems(1) = subrecordset.Fields("FIRSTNAME").Value
.SubItems(2) = subrecordset.Fields("MIDDLENAME").Value
.SubItems(3) = subrecordset.Fields("LASTNAME").Value
.SubItems(4) = Format(mainRecordset.Fields("START_TIME").Value, "hh:mm AMPM")
.SubItems(5) = mainRecordset.Fields("PURPOSE").Value
End With
mainRecordset.MoveNext
End With
End If
Loop
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|