sql query via vfp

Regie Velasco
Regie Velasco used Ask the Experts™
on
i have sql table with field named arabdes with type nvarchar (100) and with arabic letter entries, i'm trying to retrieve via visual foxpro, but i keep getting ????? instead of the data itself, and the field type on my query is only character and not varchar, can anyone help me with to correctly retrieve this information correctly, thanks in advance
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Visual FoxPro does not process Unicode (nvarchar) strings without explicit conversion obviously.
What Code Page do you use in VFP?
Are you able to display/enter such characters directly in VFP?
What ODBC driver do you use?

If you would like to obtain the data without any conversion then you may issue the following query:
SELECT arabdes, CAST(arabdes AS varbinary(200)) arabdesCNV FROM YourTable

And the arabdesCNV column will create a memo field which will contain Unicode text. Depending on FoxPro Code Page used you'll be able to display the memo after conversion or not... The best function for conversion is STRCONV() or possibly also CPCONVERT().

Unicode characters is possible to print via new report engine with your own Report listener and/or display in 3rd party OLE controls. Everything is rather complex...

More about Unicode in VFP is here: https://www.west-wind.com/presentations/foxunicode/foxunicode.html
All VFP International features are described e.g. here: http://stevenblack.com/intl-vfp/

Author

Commented:
Thanks a bunch for the suggestion, will try to work on it and reply for result
Software Developer
Commented:
CursorSetProp("MapVarchar",.t.,0) before SQLExec or execution of remote views to get varchars in VFP, notice varchars still only go up to 254 chars. Also see Sys(987). You'll also need an ANSI codepage having that arabic characters, if you go for that mapping, it's not magic though, if you don't run with a codepage having arabic this mapping always gives you ?????- If you keep translation off, you get the data 1:1 but will need a unicode capable control to display it.

https://www.west-wind.com/wconnect/weblog/ShowEntry.blog?id=608

Bye, Olaf.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

The Arabic characters should be displayed correctly when the VFP Code Page is set to 1256 and the Windows language for Non-Unicode programs is set to Arabic (available in Regional settings).

Author

Commented:
Thanks pcelba for the code page settings, been searching it on google for a while and ur my answered prayer

Author

Commented:
Thanks a bunch olaf, will try it as well

Author

Commented:
Got my problem solved guys, thanks a lot for the help, you guys are awesome

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial