Board index » delphi » Problems with Varchar field larger than 255

Problems with Varchar field larger than 255

I have a SQL Server 7 database with a table that has a field which is
VarChar(2000)

I am connecting to said database using the BDE (D5).  I have a TQuery
Component which SQL is something alon the lines of;

select MyVarChar2000 from MyTable.

However, when i access the field, say load it into local variable;

MyString := MyQuery.FieldByName('MyVarChar2000').AsString

MyString only contains the first 255 characters of the field

Anyone know why this is and how to fix it?

Unfourtunately, moving to ADO is not an option at present.

TIA

Dan

 

Re:Problems with Varchar field larger than 255


Dan,

  Microsoft didn't update their DBLib (which the BDE uses) to support the
new features of MSSQL 7 and 2000.

http://community.borland.com/article/0,1410,28688,00.html
http://community.borland.com/article/0,1410,10359,00.html
http://community.borland.com/article/0,1410,19694,00.html

Good luck,
krf

Quote
"Dan" <dan_remove_...@borer.co uk> wrote in message

news:3e5deb5f$1@newsgroups.borland.com...
Quote
> I have a SQL Server 7 database with a table that has a field which is
> VarChar(2000)

> I am connecting to said database using the BDE (D5).  I have a TQuery
> Component which SQL is something alon the lines of;

> select MyVarChar2000 from MyTable.

> However, when i access the field, say load it into local variable;

> MyString := MyQuery.FieldByName('MyVarChar2000').AsString

> MyString only contains the first 255 characters of the field

> Anyone know why this is and how to fix it?

> Unfourtunately, moving to ADO is not an option at present.

> TIA

> Dan

Re:Problems with Varchar field larger than 255


Kevin,

No new features in his code. The field is a VarChar(2000), the BDE and
DBLib shouldn't have a problem with it. We use it all the time on
VarChar(32000) fields.

I'd ensure you have the latest BDE client installed, check the Type
of MyString and see if the table already has fielddefs assigned to it.
(i.e. fields set at design time).

Other than that, it should work.

A VarChar2(2000) wouldn't not work.

Quote
"Kevin Frevert" <kfrevert@workdrinkingcoffeedotcom> wrote in message

news:3e5e156c$1@newsgroups.borland.com...
Quote
> Dan,

>   Microsoft didn't update their DBLib (which the BDE uses) to support the
> new features of MSSQL 7 and 2000.

> http://community.borland.com/article/0,1410,28688,00.html
> http://community.borland.com/article/0,1410,10359,00.html
> http://community.borland.com/article/0,1410,19694,00.html

> Good luck,
> krf

> "Dan" <dan_remove_...@borer.co uk> wrote in message
> news:3e5deb5f$1@newsgroups.borland.com...
> > I have a SQL Server 7 database with a table that has a field which is
> > VarChar(2000)

> > I am connecting to said database using the BDE (D5).  I have a TQuery
> > Component which SQL is something alon the lines of;

> > select MyVarChar2000 from MyTable.

> > However, when i access the field, say load it into local variable;

> > MyString := MyQuery.FieldByName('MyVarChar2000').AsString

> > MyString only contains the first 255 characters of the field

> > Anyone know why this is and how to fix it?

> > Unfourtunately, moving to ADO is not an option at present.

> > TIA

> > Dan

Re:Problems with Varchar field larger than 255


Varchar(32000) ?  What is Varchar2(2000)?

Are you using BDE->ODBC->MSSQL or the BDE's MSSQL native links?

krf

Quote
"Brett Watters" <bwatt...@geometrix.bc.ca> wrote in message

news:3e5e7dff$2@newsgroups.borland.com...
Quote
> Kevin,

> No new features in his code. The field is a VarChar(2000), the BDE and
> DBLib shouldn't have a problem with it. We use it all the time on
> VarChar(32000) fields.

> I'd ensure you have the latest BDE client installed, check the Type
> of MyString and see if the table already has fielddefs assigned to it.
> (i.e. fields set at design time).

> Other than that, it should work.

> A VarChar2(2000) wouldn't not work.

Re:Problems with Varchar field larger than 255


Quote
> No new features in his code. The field is a VarChar(2000),

? Varchars longer than 256 were new in SQL 7. They are not supported through
DBLib, the data access method used by SQL Links.

Quote
> A VarChar2(2000) wouldn't not work.

? Either the English is wrong, or the idea is wrong; Sorry, can't work out
what you're trying to say here.

Microsoft were quite plain that new features in MSSQL 7 such as strings
longer than 256 would only be available through OLE DB, not DB Lib. This is
not a BDE issue, but an SQL Links/DBLib issue.

Moving to ADO is the only real long-term option in my view. Dan states this
as not being an option for him; that really puts us in the situation of
immovable object/irresistable force. Not a big help I know, but after
programming Delphi/MSSQL since 1995, that's my opinion.

Dean
Pontefract, England

Re:Problems with Varchar field larger than 255


On Thu, 27 Feb 2003 10:41:03 -0000, "Dan" <dan_remove_...@borer.co uk>
wrote:

Quote
>I have a SQL Server 7 database with a table that has a field which is
>VarChar(2000)
>I am connecting to said database using the BDE (D5).  I have a TQuery
>Component which SQL is something alon the lines of;

>select MyVarChar2000 from MyTable.

>However, when i access the field, say load it into local variable;
>MyString := MyQuery.FieldByName('MyVarChar2000').AsString

>MyString only contains the first 255 characters of the field
>Anyone know why this is and how to fix it?

You can't - it's a limitation in BDE / (MS) DB-Lib. You can only
either move to ADO, or you have to deal with these fields > 255 chars
as "Blobs", e.g. use a TBlolbStream to access them.

Marc
================================================================
Marc Scheuner                        May The Source Be With You!
Bern, Switzerland                            m.scheu...@inova.ch

Re:Problems with Varchar field larger than 255


Thanks for everyones responses.

Just off to chat to the boss about pushing the converting to ADO task up the
priority list! ;)

Dan

Other Threads