开发者

Data report in VB 6.0

I'm using data report in VB 6 and trying to display images from database. It retrieves the image but showing the same image for all output the code i'm using are given below

Dim rs As ADODB.Recordset, rs1 As ADODB.Recordset

Dim a As String
k = 0
i = 0
j = 0
k = 0



Set rs = New ADODB.Recordset

With rs

    .CursorType = adOpenDynamic
    .LockType = adLockOptimistic
    .ActiveConnection = conn
    .Source = "SELECT patientid FROM I开发者_如何学Pythonnpatients_Maintenance WHERE (ModDate >= '" & frmDate & "') AND (ModDate <= '" & endDate & "')"
    .CursorLocation = adUseClient
    .Open

    Do Until rs.EOF

    If (rs.EOF = False And rs.BOF = False) Then
    pid(i) = rs.Fields(0).Value

    End If
    i = i + 1
    rs.MoveNext

    Loop
End With

Set rs = Nothing
Set rs1 = New ADODB.Recordset

Dim id As String
With rs1
    .CursorType = adOpenDynamic
    .LockType = adLockOptimistic
    .ActiveConnection = conn

    For j = 0 To i - 1
        id = pid(j)
       .Source = "Select photo from patientImage where patientid='" & id & "'"
       .CursorLocation = adUseClient
       .Open


        If (rs1.EOF = False And rs1.BOF = False) Then
            p(j) = App.Path + "\patients\" + rs1.Fields(0).Value
            a = p(j)

            Set RptInpatientMaster.Sections("Section1").Controls("Image2").Picture = LoadPicture(a)

        End If
        .Close
    Next j
End With


Do you only see the last one?

Set RptInpatientMaster.Sections("Section1").Controls("Image2").Picture = LoadPicture(a)

you always refer to same picture inside your report, isn't it?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜