Long Varchar Field Driving Me Batty in C#!


I’m trying to retrieve a Long Varchar column from a Sybase Adaptive Server Anywhere 9 database in a C# client application using the .NET OleDB libraries.

I’ve tried both OleDBDataReader and OleDBDataAdapter.  I don’t get an error when executing the query, but when attempting to retrieve the Long Varchar field, I get a length of zero from the DB using OleDBDataReader.GetChars, and when attempting to cast into a string, I end up with the empty string.

If I shorten the data in the field to 20 or 30 characters, it works.  But at some threshold, the data is too big and I can’t retrieve the data.  The data I’m trying to retrieve is around 10,000 characters.

Any ideas?
PegasusAloftAsked:
Who is Participating?
 
Joe WoodhousePrincipal ConsultantCommented:
Double-check your driver versions. Older versions may not support more recent additions like large character types. I've seen numerics beyond a certain size truncated in earlier versions of the ASE drivers, for instance.
0
 
leonstrykerCommented:
Take a look here for your connections string and it will point you the ASE ADO.NET guide as well:

http://www.carlprothman.net/Default.aspx?tabid=86#AseClientManagedProvider

Leon
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.