07-28-2010 08:59 AM
Hello,
I'm trying to query nVarchar (Unicode) from SQL Server 2008 using DB Toolkit, but it seems that the result is Varchar (Ascii).
The string contains Δ (Delta) but I receive ? (Question Mark) I've used Arial Unicode MS and configured Labview.ini to allow Unicode UseUnicode=True
I've also tried forcing the query to Convert or Cast to nVarchar but didn't make any difference.
Any idea what the DB Toolkit is doing? I've tried the Select and Execute Vis but no difference.
I probed the Variant returned from the query and it contains ? instead of Delta
Best Regards,
Solved! Go to Solution.
07-28-2010 10:41 AM
There is a Document on NI Database Connectivity Toolkit:L http://www.ni.com/pdf/manuals/321525c.pdf
It seems that String/Path is Mapped as Varchar Only. So, what's the workaround to query Unicode String?
07-28-2010 12:19 PM
Does anybody know how to Query database using Activex other than using the Database Connectity toolkit which is pretty much the same thing?
I need my query string results to be in Unicode not just Default Labview String (Ascii?)
Thanks,
07-28-2010 08:48 PM
It has been two years since we tried to query a Unicode string from a database, but at that time the Database Connectivity toolkit was completely incapable of returning a Unicode (UTF-8, UTF-16...) string. A colleague was forced to write some external functions in a DLL that queried the database.
I don't know if the Database Connectivity toolkit still suffers from the inability to use Unicode, but since then I have also had success using Postgres and MySQL Connectors with .NET.
Another option might be to use BLOB instead of VARCHAR fields.
I only have moderate experience with this topic, so you may find a better solution.
07-28-2010 11:34 PM
Thanks Jack,
I ended up using .NET System.Data (OLEDB) to query the nVarchar (Unicode String) from database and loaded a DataGridView placed in a .NET Container. I verified and it returned the proper characters.
07-29-2010 12:51 PM
Just to add that I was able to get the Proper encoding displayed in the DataGridView, however when I use toString method to convert the DataSet to String Array, same thing happens again and the results are shown in ASCII
02-04-2018 12:56 PM
I solved by forcing the query to CAST the nvarchar field as BINARY.
i.e. use the query command SELECT CAST(fieldname AS BINARY) FROM table to retrieve the correct UT16-LE byte array and so read the correct unicode string saved in nvarchar field.
Configure Labview.ini to allow Unicode UseUnicode=TrueEnable and enable the property of the string control: 'Interpret as Unicode'.
See the bitmap for an example..
03-25-2025 08:04 AM
Ciao Fabiomoro,
do you know how I have to write the query, having more than one filed to select ?
Do you know I have to chose the filed in ACCESS to made it works with the CAST ?
(nvarchar = ? ) text , short text
thanks
03-25-2025 08:47 AM
Hi,
I'm trying to use this query to query an Access Database, with DBTools, but I allways get an error:
"parameter missing".
What I'm doing wrong?
03-25-2025 10:46 AM
Sorry but I don't think the CAST command works in MS Access. I tried it only in MS SQLServer in the past