<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><category>pcsoft.us.windev</category><copyright>Copyright 2026, PC SOFT</copyright><lastBuildDate>22 May 2020 18:00:04 Z</lastBuildDate><pubDate>22 May 2020 18:00:04 Z</pubDate><description>Hello everyone and I hope you are all safe and well in these unprecedented times.&#13;
&#13;
I am hoping someone may be able to shine some light on an issue that so far I have been unable to solve.  The task should be a simple one, saving a jpg image into a VarBinary(Max) field in MS SQL Server (SQL Express) utilising SQLConnectWS from an Android solution connecting with the Reserved Server for connecting to external databases.&#13;
&#13;
Here is the code we have been testing with and if we replace the WDBinaryMemo line with a NULL line it works fine.  &#13;
&#13;
sSQL is string&#13;
nConnect is int&#13;
sDate is string&#13;
sPhoto is string = "C:\Temp\Happy.jpg"&#13;
sDate = DateToString(DateSys(),"MM/DD/YY") + " " + TimeToString(TimeSys(),"HH:MM:SS")&#13;
&#13;
HDeleteAll(Picture)&#13;
&#13;
IF fFileExist(sPhoto) = True THEN&#13;
	&#13;
	Picture.FileName = sPhoto&#13;
	Picture.GPSLat = ""&#13;
	Picture.GPSLong = ""&#13;
	Picture.KeyID = 1&#13;
	Picture.Notes = "Test From Emulator"&#13;
	Picture.PicDateTime = DateSys() + TimeSys&#13;
	Picture.PictureTypeID = ""&#13;
	Picture.USERID = 1&#13;
	HAdd(Picture,hAffectBrowse)&#13;
	&#13;
	IF InternetConnected() = True THEN&#13;
		&#13;
		nConnect = SQLConnectWS(gsWSAddress,gsODBC, gsWSUser,gsWSPass, gsWSDataBase,"OLE DB", hODBC)&#13;
		&#13;
		IF nConnect &gt; 0 THEN			&#13;
			&#13;
			sSQL = "INSERT INTO Picture" + CR &#13;
			sSQL = sSQL + "(" + CR&#13;
			sSQL = sSQL + "PictureTypeID," + CR &#13;
			sSQL = sSQL + "KeyID," + CR &#13;
			sSQL = sSQL + "Notes," + CR &#13;
			sSQL = sSQL + "UserID," + CR &#13;
			sSQL = sSQL + "Photo," + CR &#13;
			sSQL = sSQL + "Thumbnail," + CR &#13;
			sSQL = sSQL + "LastLat," + CR &#13;
			sSQL = sSQL + "PhotoTime," + CR &#13;
			sSQL = sSQL + "LastLong," + CR &#13;
			sSQL = sSQL + "PictureFileName," + CR &#13;
			sSQL = sSQL + "NewPic" + CR &#13;
			sSQL = sSQL + ")" + CR &#13;
			sSQL = sSQL + "VALUES" + CR &#13;
			sSQL = sSQL + "(" + CR &#13;
			sSQL = sSQL + "1," + CR &#13;
			sSQL = sSQL + "1," + CR &#13;
			sSQL = sSQL + "'" + Picture.Notes +  "'," + CR &#13;
			sSQL = sSQL + Picture.USERID + "," + CR &#13;
			sSQL = sSQL + "NULL," + CR &#13;
			sSQL = sSQL + "NULL," + CR &#13;
			sSQL = sSQL + "NULL," + CR &#13;
			sSQL = sSQL + "'" + sDate + "'," + CR &#13;
			sSQL = sSQL + "NULL," + CR &#13;
			sSQL = sSQL + "NULL," + CR &#13;
			//sSQL = sSQL + "{WDBinaryMemo('" + "C:\Temp\Install.txt" + "','TextFile')}" + CR &#13;
			sSQL = sSQL + "{WDBinaryMemo('" + Picture.FileName + "'}" + CR &#13;
			sSQL = sSQL + ")" + CR &#13;
			&#13;
			IF SQLExec(sSQL,"SendPic") = False THEN&#13;
				&#13;
				SQLInfo("SendPic")&#13;
				ToClipboard(SQL.MesError)&#13;
				Error(SQL.MesError)	&#13;
				&#13;
			END&#13;
			&#13;
		ELSE&#13;
			&#13;
			SQLInfo()&#13;
			Info("SQL error: " + SQL.MesError)&#13;
			&#13;
		END&#13;
		&#13;
	END&#13;
	&#13;
	SQLClose("SendPic")&#13;
	SQLDisconnect()	&#13;
&#13;
ELSE&#13;
	&#13;
	Error(sPhoto + " not found")&#13;
	&#13;
END&#13;
&#13;
&#13;
The code detailed here has the picture file directly referenced from C:\Temp and we are testing this from the emulator and not on an android device.&#13;
&#13;
On the Reserved Server side we are using ODBC SQL Client 11&#13;
&#13;
Anyone have any ideas as to why this is not working?</description><ttl>30</ttl><generator>WEBDEV</generator><language>en_US</language><link>https://forum.pcsoft.fr/es-ES/pcsoft.us.windev/67837-inserting-image-into-sql-server-varbinarymax-field-using/read.awp</link><title>Inserting an image into a SQL Server VarBinary(Max) Field using WDBinaryMemo</title><managingEditor>moderateur@pcsoft.fr (El moderador)</managingEditor><webMaster>webmaster@pcsoft.fr (El webmaster)</webMaster></channel></rss>
