I needed to retrieve image fields on SQL Server 7.0 with VB6, and I couldn’t find any article about it. So, I assume others have had the same problem. I’ve since found a method for doing it.
You must use Microsoft ADO 2.5 and set it into the following project reference:
dim rst as new adodb.recordsetdim adoConn as new adodb.Connection
You also have to open the connection with the database.
'Open recordset....rst.Open "Select * from
where ", adoConn, adOpenKeyset,adLockOptimistic'THIS FUNCTION SAVES AN IMAGE
INTO AN IMAGE DATATYPE FIELDPrivate Function SaveImage() Dim mStream As New ADODB.Stream With mStream .Type = adTypeBinary .Open .LoadFromFile "NAME>" rst("").
Value = .Read rst.Update End With Set mStream = NothingEnd Function'THIS FUNCTION LOAD IMAGE FROM
IMAGE DATATYPE FIELD AND SAVE IT INTO AFILE.....Private Function LoadImage() Dim mStream As New ADODB.Stream With mStream .Type = adTypeBinary .Open .Write rst("") .SaveToFile "NAME>", adSaveCreateOverWrite End With Set mStream = NothingEnd Function Aside from this method, you can use a picture control to store an image,put a picture control into a form, and call it PictureTemp.
PictureTemp.DataField = "Immagine"
'Set DataField....Set PictureTemp.DataSource = rst
'Set DataSource
You can use the PictureTemp.Picture property to get your image.
Private Function LoadImage() Dim mStream As New ADODB.Stream With mStream .Type = adTypeBinary .Open PictureTemp.DataField = "Immagine"
'Set DataField.... Set PictureTemp.DataSource = rst
'Set DataSource Set MSFGRID.CellPicture = PictureTemp.Picture
'Show image into a cell ofMicrosoft FlexGrid End With Set mStream = NothingEndFunction
About Our Editorial Process
At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.
See our full editorial policy.
About Our Journalist
Charlie Frank
Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience. View Author Media mogul poised for $1 billion boost if shares surge
Cameron Wiggins April 24, 2024 5:19 PM Bitcoin miners’ strategy stabilizes market pre-halving
Noah Nguyen April 24, 2024 5:12 PM Digital banking tackles fraud with advanced methods
Johannah Lopez April 24, 2024 1:55 PM Wealth accumulation: Path to personal freedom and societal impact
Cameron Wiggins April 24, 2024 1:25 PM Japan’s finance minister warns of currency market intervention
Rashan Dixon April 24, 2024 1:14 PM TabaPay set to acquire Synapse’s assets
April Isaacs April 24, 2024 11:58 AM Baton Rouge Entrepreneurship Week 2024 announced
Cameron Wiggins April 24, 2024 11:36 AM Netherlands thriving in European venture capital growth
Noah Nguyen April 23, 2024 5:42 PM Fintech startup Ramp sees formidable growth
Cameron Wiggins April 23, 2024 5:14 PM Is Bitcoin the New Gold? Understanding Cryptocurrency as a Hedge Against Inflation
Rashan Dixon April 23, 2024 4:05 PM Zipline delivers millionth order, aims higher
Rashan Dixon April 23, 2024 3:49 PM Embracer Group splits into three, boosts efficacy
Johannah Lopez April 23, 2024 1:58 PM Predicted 2025 COLA sees modest growth
Noah Nguyen April 23, 2024 1:50 PM Unexpected eviction unsettles Indianapolis businesses
Cameron Wiggins April 23, 2024 11:46 AM Final April disability payment scheduled for release
Johannah Lopez April 23, 2024 8:08 AM Social Security amends SSI eligibility for 2024
Johannah Lopez April 23, 2024 8:01 AM Silver tsunami presents opportunity for young entrepreneurs
Johannah Lopez April 23, 2024 8:00 AM Unexpected eviction disrupts Indianapolis businesses
Cameron Wiggins April 23, 2024 7:51 AM Embracer Group restructures into three entities
April Isaacs April 23, 2024 7:07 AM Mercedes-AMG unveils powerful, innovative 2025 GT 63 S E Performance
Johannah Lopez April 22, 2024 5:45 PM Google poised for notable organizational changes
Johannah Lopez April 22, 2024 5:29 PM Merging Catholic faith with entrepreneurial education
April Isaacs April 22, 2024 3:59 PM AI entrepreneur raises $13.8 million via LinkedIn
April Isaacs April 22, 2024 3:35 PM Why ChatGPT Is So Important Today
Grace Phillips April 22, 2024 3:07 PM How Tech Advancements and Tools Have Enhanced Business
Kyle Lewis April 22, 2024 2:22 PM