BDE TQuery reading a SQL Server VarChar(500)

Posted on 2004-11-22
Last Modified: 2013-11-23

I previously posted this same question in the wrong section so I apologize if you read this post twice.

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 :)
Question by:qas
    LVL 13

    Expert Comment

    you might want to check the BDE configuration, at the BLOB SIZE property, either increase that or set it to -1 and see if that works

    Author Comment

    Hi :)

    Setting the BlobSize property to -1 gave me an error ("Invalid or out of range dboption parameter").  Setting it to 1024 did not solve my problem.  Still have a 255 char field instead of 500.

    Any hint ?
    LVL 14

    Expert Comment

    I think by reading it as TMemoField, it might work as well?
    LVL 13

    Expert Comment

    or as a TBlobField...

    Author Comment

    Thanks for the comments.

    How do I tell a TQuery to read the field as a TMemoField ?

    When I open the query it automatically creates a TStringField.

    Thanks again :)

    Author Comment

    Ok I got it.

    I added a new field and gave it the same name as the field from table.  I tried TMemoField, TWideStringField and TBlobField.  I always get a Type Mismatch Exception.

    Any more hint ?
    LVL 5

    Accepted Solution

    I think the problem is that you are using SQL Server native drivers. They are based on DBLibrary, which goes way back to SQL Server 1.0. Up to SQL Server 6.5 (or 7, I forget which), the biggest varchar you could have was 255. DBLibrary is still supported, but I seem to remember it's for backward compatibility only, in other words, it will only handle old datatypes.

    Try going via an ODBC connection instead of using the BDE SQL Server driver.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
    Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now