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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String type + Image type concatenation problem

Status
Not open for further replies.

manum79

Programmer
Dec 14, 2005
6
US
i am developing a form where i am collecting personal information such as name, address and signature of the person as a bmp file........ i am saving the data in the SQL Server 2005

i am building a SQL query to insert the record.......
the prob that i m facing is that i cannot concatenate the image type with the SQL string that i m building

the insert works fine if i dont try to insert the image

the image is saved in a column of datatype "IMAGE"

plz help

thanks,
Manu
 
But there is no 'IMAGE' data type in VFP.

You may be able to read the image in using something like SomeVar = FILETOSTR('ImageFile'), then insert the image into SQL using SomeVar. I can't test it myself though.


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
If I remember well (not sure at all) you must do something like:
Code:
lcContent = "0x"+strconv(FileToStr("somepicturefile.jpg"),15)
SQLEXEC(sqlH,[INSERT INTO SQLTable (ImageField) VALUES (?m.lcContent)])

Borislav Borissov
 
thanks guys for all the replies .......

i tried the below code

lcContent = "0x" + strconv(FileToStr(FilePath) ,15)

and tried inserting it.......it did insert the image into the table but next time when i tried to retrieve the image its giveing me the following error message

OLE object is invalid or corrupted.
Unbinding object 'controlname'

i m displaying the image in an OLE object

thanks
manu
 
Hello Borislav Borissov, I tried as you said, but my data is getting corrupted.
here is the code please help...

lcCurrDir = SYS(5) + SYS(2003)
lcFile = GETFILE("BMP")
IF !EMPTY(lcFile)

lcContent = "0X" + STRCONV(FILETOSTR(lcFile),15)
lcsql = "Update tblusers set us_gsignature = " + lcContent + " where Us_nid =" + ALLTRIM(STR(thisform.txtnId.value))

DO sqlreturncursor WITH lcsql, "check123"
ENDIF
SET DEFAULT TO (lcCurrDir)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top