Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Manually update imageFile

$
0
0
I have a form which uploads an image. It works correctly.

Now I want to add a button to delete the image manually.
My approach:
Code:


Record updateRec = new Record();       
                                updateRec.setAttribute("f_id", Id);       
                                updateRec.setAttribute("f_foto", (Byte[])null);       
                                updateRec.setAttribute("f_foto_date_created", (Date)null);                       
       
updateRec.setAttribute("f_foto_filename", (String)null);
                                                updateRec.setAttribute("f_foto_filesize", (Integer)null);
DataSource.get("fotos").updateData(updateRec);

The problem I have is with the

Code:

updateRec.setAttribute("f_foto", (Byte[])null);
I just want to set it to null, but which type it should be? I get an SQL Error:
Code:

"Implicit conversion from data type nvarchar to varbinary(max) is not allowed. Use the CONVERT function to run this query."
The query executed:
Code:

UPDATE t_schueler SET f_foto=?, f_foto_date_created=NULL, f_foto_filename=NULL, f_foto_filesize=NULL WHERE (t_schueler.f_id=8985)
I just want to create a query like:
Code:

UPDATE t_schueler SET f_foto=NULL, f_foto_date_created=NULL, f_foto_filename=NULL, f_foto_filesize=NULL WHERE (t_schueler.f_id=8985)
Using SmartGWT 4.0 Power.
Thanks

Viewing all articles
Browse latest Browse all 4756

Trending Articles