PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WINDEV 2024 → Consultancy Assistance required for WDBinaryMemo
Consultancy Assistance required for WDBinaryMemo
Iniciado por Lee SHRODER ( RL Sol, nov., 07 2020 1:43 PM - Sem resposta
Membro registado
7 mensagems
Publicado em novembro, 07 2020 - 1:43 PM
Hi All,

I am looking for someone to offer me some consultancy to get a function working for uploading an image into a MSSQL server database using SQLConnectWS and WDBinaryMemo.

The task should be simple but for some reason I can't seem to get it to work and I have been trying for a while now.

The setup is as follows:-

There is a JPG file located in the EXE directory called Happy.jpg, and I am using Windev 25 to create a simple window with one button to run the code.
There is an offsite SQL server that has the following structure:-

DBName = TestDB
TableName = Files
Column = Picture (VarBinary(MAX)) - Also tested with an Image Type.

I am able to use SQLConnectWS to write standard text into this field so I know that the SQConnectWS functions are working.

Here is the code I am trying to use to send the image, please note that I have replaced the connection string info so as not to publicly detail how to connect:-

sSQL is string
nConnect is int
sFile is string = fExeDir() + "\Happy.jpg"

IF InternetConnected () = True THEN

nConnect = SQLConnectWS ("SERVER","ODBC","USER","PASSWORD","DATABASE","OLE DB", hODBC)

IF nConnect > 0 THEN

IF FFileExist(Sfile) = True THEN

sSQL = "INSERT INTO Files VALUES ({WDBinaryMemo('" + sFile + "')})"

IF nConnect <> 0 THEN

IF SQLExec ( sSQL , "SendPIC" ) = False THEN

SQLInfo ( "SendPIC" )
Info ( SQL.MesError )

END

END

END

END

SQLClose ( "SendPic" )
SQLDisconnect ()

END

This always results in an empty SQL.MesError result failure and I have tried a various different variants of the command with no success. If I replace the SQL string to the following command I can write to the database successfully:-

sSQL = "INSERT INTO Files VALUES ('1234')"

So the issue seems to be around the WDBinaryMemo function, as detailed I am willing to pay for a couple hours of consultancy with remote access to my development platform to resolve this and welcome any suggestions to its resolution.

Thank you all for any help that can be offered with this.


Kindest Regards,

Lee Shroder