Board index » delphi » Mssql 7.0 new data type,Delphi filter error

Mssql 7.0 new data type,Delphi filter error

I use Mssql 7.0,Delphi 4.0 with pack 3,BDE 5.01 latest version. I find some
error.

1.When I use a ttable to connect a table authors with uniqueidentifier
column, if ttable.tablename is dbo.authors, the ttable connot be opened,
report an error 'invalid
 data type', if ttable.tablename does not contain 'dbo', the table can be
opened correctly.

2.So I fill ttable.tablename without 'dbo.',the next error is: when I use a
filter 'phone is null', it does not work. I trace it with profiler, the sql
becomes 'where 0=1'; if ttable.tablename contains 'dbo', the sql is correct.

3.For tquery, error 2 is the same.

I have to use uniqueidentifier data type and filter, what should I do?

 

Re:Mssql 7.0 new data type,Delphi filter error


Quote
borland wrote in message <7g0klp$f...@forums.borland.com>...
>I use Mssql 7.0,Delphi 4.0 with pack 3,BDE 5.01 latest version. I find some
>error.

>1.When I use a ttable to connect a table authors with uniqueidentifier
>column, if ttable.tablename is dbo.authors, the ttable connot be opened,
>report an error 'invalid
> data type', if ttable.tablename does not contain 'dbo', the table can be
>opened correctly.

>2.So I fill ttable.tablename without 'dbo.',the next error is: when I use a
>filter 'phone is null', it does not work. I trace it with profiler, the sql
>becomes 'where 0=1'; if ttable.tablename contains 'dbo', the sql is

correct.

Running against an SQL backend I strongly recommend using TQuery instead of
TTable and *not* using the Filter property. Use a Where clause in the SQL
statement instead:

select * from authors where phone is null

--
Wayne Niddery - WinWright Consulting
Delphi, C++Builder, JBuilder, InterDev --
http://home.ican.net/~wniddery/RADBooks.html
"It is not true that the function of law is to regulate our consciences, our
ideas, our wills, our education, our opinions, our work, our trade, our
talents or our pleasures. The function of law is to protect the free
exercise of these rights." - Frederic Bastiat, 1850

Re:Mssql 7.0 new data type,Delphi filter error


I keep hearing that it is better to use a TQuery instead of TTable for SQL
Server access....  what if you need to update (e.g.: put the data into a
DBGrid)?  It would seem that a TTable is the only choice since TQuery is
read-only and TUpdateQuery can't provide a view.  Please clear this up for me if
I'm missing something.
Quote
"Wayne Niddery (TeamB)" wrote:
> borland wrote in message <7g0klp$f...@forums.borland.com>...
> >I use Mssql 7.0,Delphi 4.0 with pack 3,BDE 5.01 latest version. I find some
> >error.

> >1.When I use a ttable to connect a table authors with uniqueidentifier
> >column, if ttable.tablename is dbo.authors, the ttable connot be opened,
> >report an error 'invalid
> > data type', if ttable.tablename does not contain 'dbo', the table can be
> >opened correctly.

> >2.So I fill ttable.tablename without 'dbo.',the next error is: when I use a
> >filter 'phone is null', it does not work. I trace it with profiler, the sql
> >becomes 'where 0=1'; if ttable.tablename contains 'dbo', the sql is
> correct.

> Running against an SQL backend I strongly recommend using TQuery instead of
> TTable and *not* using the Filter property. Use a Where clause in the SQL
> statement instead:

> select * from authors where phone is null

> --
> Wayne Niddery - WinWright Consulting
> Delphi, C++Builder, JBuilder, InterDev --
> http://home.ican.net/~wniddery/RADBooks.html
> "It is not true that the function of law is to regulate our consciences, our
> ideas, our wills, our education, our opinions, our work, our trade, our
> talents or our pleasures. The function of law is to protect the free
> exercise of these rights." - Frederic Bastiat, 1850

Other Threads