02-08-2013 11:14 AM
I'm trying to save a png image (front panel image or chart image) to SQL server image field or varbinary(max) field directly but couldn't make it like mentioned in this article
http://zone.ni.com/devzone/cda/epd/p/id/5210
A simple binary file is okay to save but not an image file either in the format of "image data" or "png data".
Anyone familiar with the subject can give some suggestions? Thanks in advance.
02-10-2013 07:00 PM
Are you trying save directly as a parameter of SQL Instrucion (insert into or update)? If yes, you need escape special characters. Like " (double quotes).
Refer to SQL Server special characters. For my case I'm using this function to escape characters to MySQL instructions.
02-11-2013 01:03 AM
Hi bruno_costa,
Thanks for your respond to my post. It looks very reasonable to add the escape procedures, but after adding it, I still couldn't make it through. The following is the error, the error code of -2147217887 is endefined. Also, I haven't found the ADO Error of 9x80040E21 which will fit my case yet.
NI_Database_API.lvlib:Cmd Execute.vi->NI_Database_API.lvlib:DB Tools Insert Data.vi->save png - Copy.vi<ERR>ADO Error: 0x80040E21
Exception occured in Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC SQL Server Driver]String data, right truncation in NI_Database_API.lvlib:Rec Create - Command.vi->NI_Database_API.lvlib:Cmd Execute.vi->NI_Database_API.lvlib:DB Tools Insert Data.vi->save png - Copy.vi
Guangde
02-11-2013 01:32 AM
Isn't there some 8k limit to the sql string?
/Y
02-11-2013 03:37 AM
02-11-2013 09:07 AM
For SQL Server Express, there are varbinary(max) and image data types which will not have the limitation of 8k. Please check the following link:
http://msdn.microsoft.com/en-us/library/ms188362.aspx
Still the size or type is a factor here, for the VI, I can send an ordinary string to the table but not a png file.