MySQL Forums
Forum List  »  Newbie

Re: Entering binary data into table
Posted by: Raj Julha
Date: August 17, 2004 02:40PM

You can have a look at http://www.vbmysql.com/samplecode/basicblob.html

or
If you're using VB6 then I suggest you use ADODB.Stream and the ADODB.Command object. Here's a code snapshot. Haven't tried this piece in code but I guess you'll have an idea

Dim lcObjCmd as ADODB.Command
Dim lcObjStream as ADODB.Steam
Dim lcObjParam as ADODB.Parameter
' Add code to open connection etc.

set lcobjcmd = new adodb.command

lcObjcmd.Commandtext = "insert table1(customerid, phone) select ?, ?"

set lcobjparam = lcobjcmd.CreateParameter("@customerid", adInteger, adParamInput)
lcobjcmd.Parameters.Append lcobjparam

set lcobjparam = lcobjcmd.CreateParameter("@photo", adBinary, adParamInput)
lcobjcmd.Parameters.Append lcobjparam

set lcObjStream = new ADODB.Stream
lcobjstream.Open
lcObjStream.LoadFromFile "d:\blabla\photox.jpg"

lcobjcmd.parameters("@customer").value = 1
lcobjcmd.parameters("@photo").value = lcobjstream.Read(-1)

lcobjcmd.execute



Options: ReplyQuote


Subject
Written By
Posted
Re: Entering binary data into table
August 17, 2004 02:40PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.