Search Tools Links Login

PRINT AN IMAGE TO A DATA REPORT VIA ADO


Im sick and tired of using a third party report generator such as Crystal Reports, etc. so what i did was i mastered Data Report of Visual Basic 6 and here is sample of how to print an image to Data Report using ADO Connections. I hope you like this sample of mine.

Original Author: Walter Narvasa

Code

dim rs as ADODB.Recordset
dim db as ADODB.Connection
dim xDataPath as String
dim xPeoplePicture as String
xDataPath = App.Path & "DatabaseTest.MDB"
db.CursorLocation = adUseClient
db.Open "PROVIDER=MSDataShape;Data PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & xDataPath
Set rs = New Recordset
rs.Open "SELECT People_Name, People_Picture FROM People ORDER BY People_Name;", db, adOpenStatic, adLockOptimistic
rs.Movefirst
xPeoplePicture = rs!People_Picture ' "SAMPLE.JPG" <-Sample Contents of rs recordset
Set DataReport1.DataSource = rs
Set DataReport1.Sections(3).Controls("Image1").Picture = LoadPicture( App. Path & xPeoplePicture)
DataReport1.Show

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 75 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.