Board index » delphi » MS SQL LOGIN

MS SQL LOGIN

I use the MS SQL login to jump between databases. So my SQL is generic so it
can be run on acouple of databases.

I want my SQL to look like this: 'select * from MyTable'

but I have had to write it like this so far: 'select * from
Mydatabase.dbo.MyTable'

Is there a way to make  tadoquery default to the  default database for that
user.

I just started to use ado. So any help would be great.

--
Chris Akers
chr...@fidlar.com
Fidlar Doubleday
Software Developer

 

Re:MS SQL LOGIN


If you use the TADOConnection and all the TADOQueries references that
connection, you won't need the
MyDb.User.TableName sintax.
The select will apply to the database pointed by the TADOConnection component.

Quote
Chris Akers wrote:
> I use the MS SQL login to jump between databases. So my SQL is generic so it
> can be run on acouple of databases.

> I want my SQL to look like this: 'select * from MyTable'

> but I have had to write it like this so far: 'select * from
> Mydatabase.dbo.MyTable'

> Is there a way to make  tadoquery default to the  default database for that
> user.

> I just started to use ado. So any help would be great.

> --
> Chris Akers
> chr...@fidlar.com
> Fidlar Doubleday
> Software Developer

--
Guillermo Casta?o Acevedo
Gerente de Sistemas - Grupo Millennium Ltda
Guiller...@GrupoMillennium.com
http://www.GrupoMillennium.com

Re:MS SQL LOGIN


Put this in your connection string

Initial Catalog=DatabaseName

Jeff Langston
Cashless Systems Inc.
JeffLangs...@CashlessSystems.com

Quote
"Chris Akers" <chr...@fidlar.com> wrote in message

news:3d2ddfec$1_1@dnews...
Quote
> I use the MS SQL login to jump between databases. So my SQL is generic so
it
> can be run on acouple of databases.

> I want my SQL to look like this: 'select * from MyTable'

> but I have had to write it like this so far: 'select * from
> Mydatabase.dbo.MyTable'

> Is there a way to make  tadoquery default to the  default database for
that
> user.

> I just started to use ado. So any help would be great.

> --
> Chris Akers
> chr...@fidlar.com
> Fidlar Doubleday
> Software Developer

Other Threads