English 中文(简体)
Data report in VB 6.0
原标题:
  • 时间:2009-11-20 04:43:02
  •  标签:
  • vb6
  • report

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 Inpatients_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?





相关问题
Prevent windows from queuing shellexecute requests

Win.ShellExecute 0, "open", "C:dirprogram.exe", "arguments", vbNullString, SW_SHOWNORMAL Win.ShellExecute 0, "open", "http://www.google.com", vbNullString, vbNullString, SW_SHOWNORMAL I want google....

Why is My Loop Only Deleting One File?

Using VB6 In a folder, i have n number of files, i want to delete a 0 kb files code Dim filename5 As String filename5 = Dir$(txtsourcedatabasefile & "*_*", vbDirectory) MsgBox filename5 Do ...

How to check the filesize?

Using VB6 I have the text file with different sizes, so i want to delete the file where filesize = 0 kb. How to make a vb6 code for deleting the 0 kb files. Need vb6 code Help

File Rename problem?

I m using VB6 and I have a folder where I have n number of files. I want to change the file extension to .txt. I used the code below to change the extension of all .fin files to .txt. Dim filename1 ...

Error 20728-F while in using Crystal Reports in VB6

I m using Crystal Reports in my VB6 project, but I m facing error while loading the report in crystalreport1.action=1; Please give me some solution for this problem. It is showing the error as Error ...

DllRegisterServer entry point was not found

When running my vb6 application I am getting error like, runtime error 53 : file not found: rscomclNoMsg.dll then i tried to register that dll from cmd line using regsvr32. Then I am getting ...

SQL Server 2000, ADO 2.8, VB6

How to determine if a Transaction is active i.e. before issuing Begin Transaction I want to ensure that no previous transaction are open.. the platform is VB6, MS-SQL Server 2000 and ADO 2.8

热门标签