kanber

ODBC-Sql Server String Value problem

Recommended Posts

Hi,

When I tried to read data from SQL server with ODBC. Int values reading OK. but On nvarchar(50) values I am getting NaN. Also on Table is showing "???"

how can I solve the problem.

sqlqr.ReceteAdi column is nvarchar(50).

 

global dbase=db.Open("Deneme")

//qr = DB.Query(dbase,"Select * from dbo.Receteler")
global sqlqr = db.Query(dbase,"Select * from Receteler")

db.Close(dbase)

Share this post


Link to post
Share on other sites

Using regular Query is largely deprecated for the QueryToClass() function.  Try that one instead.  Not only is it faster (performance wise) and easier to use, it also has had more recent field type updates.

Share this post


Link to post
Share on other sites

Thank you.

 

But I have problem read sys.Tables with nvarchar type. I need to get all table name for checking somethings. How can I do that. As I see daqfactory is support varchar types. but on that system column I can't change the type.

Share this post


Link to post
Share on other sites

I believe NVarChar is for unicode.  DAQFactory isn't compiled for unicode, and so even if you could read this field type, it wouldn't look right.  Do a search on the web for converting NVARCHAR to VARCHAR inside a query (SELECT).  For example, I quickly found a database forum that shows a CONVERT() function, as well as a CAST() function.  I have not used these, but they, especially the cast() look quite promising.

Share this post


Link to post
Share on other sites

SELECT CONVERT(varchar(100),name) as name22 FROM sys.Tables

 

solved my problem. thank you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now