AllExperts > Experts 
Search      

Active Server Pages Programming (ASP)

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Active Server Pages Programming (ASP) Answers
Question Library

Ask a question about Active Server Pages Programming (ASP)
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Srini Nagarajan
Expertise
I can answer any kind of questions in ASP.NET, C#, VB.NET, SharePoint 2007, ASP, Coldfusion, Powerbuilder 7.00 / 8.00, JAVA servlets, MS SQL 2000 / MSSQL7, Sybase

Experience
Contact me if you need any custom development on ASP.NET, ASP, SharePoint 2007, Coldfusion, Powerbuilder.
 
   

You are here:  Experts > Computing/Technology > Business Software > Active Server Pages Programming (ASP) > what is ADODB.stream

Topic: Active Server Pages Programming (ASP)



Expert: Srini Nagarajan
Date: 3/16/2008
Subject: what is ADODB.stream

Question
I saw in your example code you wrote ADODB.stream but my VB.6 program don't have this data-type so what can i do ?!?!

Answer
hi

You must use Microsoft ADO 2.5 and set it into the following project reference:

dim rst as new adodb.recordset
dim adoConn as new adodb.Connection

You also have to open the connection with the database.

'Open recordset....
rst.Open "Select * from <TABLE>
where <CONDITION>", adoConn, adOpenKeyset,
adLockOptimistic


'THIS FUNCTION SAVES AN IMAGE
INTO AN IMAGE DATATYPE FIELD
Private Function SaveImage()
 Dim mStream As New ADODB.Stream

 With mStream
   .Type = adTypeBinary
   .Open
   .LoadFromFile "<IMAGE FILE
NAME>"
   rst("<IMAGE FIELD NAME>").
Value = .Read
   rst.Update
 End With
 Set mStream = Nothing
End Function

'THIS FUNCTION LOAD IMAGE FROM
IMAGE DATATYPE FIELD AND SAVE IT INTO A
FILE.....
Private Function LoadImage()
 Dim mStream As New ADODB.Stream

 With mStream
   .Type = adTypeBinary
   .Open
   .Write rst("<IMAGE FIELD NAME>")
   .SaveToFile "<DESTINATION FILE
NAME>", adSaveCreateOverWrite
 End With

 Set mStream = Nothing

End 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 of
Microsoft FlexGrid
 End With

 Set mStream = Nothing

End
Function

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.