Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read/Write images/pictures on SQL and VB6 using SP 1

Status
Not open for further replies.

paulgenga

Programmer
Jan 8, 2004
61
KE
I need help in reading a image from the database where by I have tried the code as follows but failed with the error message. *Type mismatch*
Code:
rsTemp.ActiveConnection = strConnection
rsTemp.Open "Select * FROM m_patient WHERE Dtd=0 And patient_id = " + Trim(str(FindID)), , adOpenForwardOnly, adLockReadOnly
Me.Picture1.Picture = IIf(IsNull(!general_case_study_photo), 0, !general_case_study_photo)

Please advice on how to save this picture as well
Code:
With cmdPatient
        .CommandType = adCmdStoredProc
        .ActiveConnection = strConnection
        .CommandText = "amd_m_patient"
        .Parameters("@general_case_study_photo") = Me.Picture1.Picture
        .CommandTimeout = 0
        Set rsPatient = cmdPatient.Execute

many thanks

 
I did this once, many years ago, as a proof of concept. It involved the ADO object and the GetChunk and AppendChunk methods.

Truth is, I personally think this is a bad idea. Instead, I would encourage you to create a share on the server. Then, put the files/images on the share. In the database, store the file path and name.

There are pro's and con's with each method. Storing just the filename will likely give you better performance. This is especially true if you have millions of images because you could easily set up multiple file servers for the images. If you store the images in the database, it saves you from setting up file shares (with potential security implications).

Make sense?

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 

Thanks George
It my my first attempt and my challenge is to have the pictures store in MsSQL2000 Database.
This has been very help full.[/color blue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top