BDE TQuery reading a SQL Server VarChar(500)

Hi.

I have a Table on SQL Server having a VarChar(500) field.  When I query this table using a TQuery component, it only returns the first 255 characters from the 500 char field.

I tried the same thing with TADOQuery object and it worked fine, all 500 char were returned.

I HAVE to use a TQuery object (I cannot switch to a TADOQuery).

Can anyone help me with this ?

Thanks :)
qasAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mohammed NasmanSoftware DeveloperCommented:
Hello
 
   The problem came from MS side, BDE uses DBLibrary for accessing Sql server, and MS didn't update the DBLibrary for sql server 7 and above to allow the new data types and varchar > 255

to solve this problem you need to switch to ADO

BTW, there's area of Delphi topic, if you ask the question there you will got a better and more comments for your questions

Regards,
Mohammed Nasman
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
eguillot79Commented:
Hello,

with the same problem, my solution
SELECT
CASE
   WHEN len(texte) > 255 THEN substring(texte,1,255)
   ELSE texte
END as texte1,
CASE
   WHEN len(texte) > 255 THEN substring(texte,255,len(texte)-255)
   ELSE ''
END as texte2
FROM TABLE

After in the program, Query.FieldByName('texte1').AsString + Query.FieldByName('texte2').AsString

Regards,
Emmanuel Guillot
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

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.