I manage a website that makes use of several Access databases to generate
dynamic content. I would like to ensure that my code approach does not
produce inefficiencies.

I use the same code in multiple asp pages to open data connections (that is
the same variable names, although the connection could be to a different
database).

My common code:

Set conn = server.createobject("adodb.connection")
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtemp=dsntemp & "DBQ=" & server.mappath("/database/kassaa.mdb")
conn.mode = 3 ' adModeReadWrite
conn.Open DSNtemp

Could this present a problem?

Thanks in advance.

Bob Mullen

Re: DSN-less Data Connection Code by PW

PW
Fri Mar 21 18:08:16 CDT 2008


"Bob Mullen" <BobMullen@discussions.microsoft.com> wrote in message
news:B4513CA1-82CB-4CB2-8714-37AF9577036D@microsoft.com...
>I manage a website that makes use of several Access databases to generate
> dynamic content. I would like to ensure that my code approach does not
> produce inefficiencies.
>
> I use the same code in multiple asp pages to open data connections (that
> is
> the same variable names, although the connection could be to a different
> database).
>
> My common code:
>
> Set conn = server.createobject("adodb.connection")
> DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
> DSNtemp=dsntemp & "DBQ=" & server.mappath("/database/kassaa.mdb")
> conn.mode = 3 ' adModeReadWrite
> conn.Open DSNtemp
>
> Could this present a problem?
>
> Thanks in advance.
>
> Bob Mullen



Personally I would do it like this, but yours doesn't have any problems.

myCONN = server.createobject("adodb.connection")
myDSN = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
server.mappath("/database/kassaa.mdb")
myCONN.mode = 3 ' adModeReadWrite
myCONN.Open myDSN



Re: DSN-less Data Connection Code by BobMullen

BobMullen
Fri Mar 21 21:04:00 CDT 2008

Thanks very much.

Bob Mullen


"PW" wrote:

>
> "Bob Mullen" <BobMullen@discussions.microsoft.com> wrote in message
> news:B4513CA1-82CB-4CB2-8714-37AF9577036D@microsoft.com...
> >I manage a website that makes use of several Access databases to generate
> > dynamic content. I would like to ensure that my code approach does not
> > produce inefficiencies.
> >
> > I use the same code in multiple asp pages to open data connections (that
> > is
> > the same variable names, although the connection could be to a different
> > database).
> >
> > My common code:
> >
> > Set conn = server.createobject("adodb.connection")
> > DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
> > DSNtemp=dsntemp & "DBQ=" & server.mappath("/database/kassaa.mdb")
> > conn.mode = 3 ' adModeReadWrite
> > conn.Open DSNtemp
> >
> > Could this present a problem?
> >
> > Thanks in advance.
> >
> > Bob Mullen
>
>
>
> Personally I would do it like this, but yours doesn't have any problems.
>
> myCONN = server.createobject("adodb.connection")
> myDSN = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
> server.mappath("/database/kassaa.mdb")
> myCONN.mode = 3 ' adModeReadWrite
> myCONN.Open myDSN
>
>
>

Re: DSN-less Data Connection Code by ekkehard

ekkehard
Sat Mar 22 03:08:39 CDT 2008

PW schrieb:
> "Bob Mullen" <BobMullen@discussions.microsoft.com> wrote in message
> news:B4513CA1-82CB-4CB2-8714-37AF9577036D@microsoft.com...
>> I manage a website that makes use of several Access databases to generate
>> dynamic content. I would like to ensure that my code approach does not
>> produce inefficiencies.
>>
>> I use the same code in multiple asp pages to open data connections (that
>> is
>> the same variable names, although the connection could be to a different
>> database).
>>
>> My common code:
>>
>> Set conn = server.createobject("adodb.connection")
>> DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
>> DSNtemp=dsntemp & "DBQ=" & server.mappath("/database/kassaa.mdb")
>> conn.mode = 3 ' adModeReadWrite
>> conn.Open DSNtemp
>>
>> Could this present a problem?
>>
>> Thanks in advance.
>>
>> Bob Mullen
>
>
>
> Personally I would do it like this, but yours doesn't have any problems.
>
> myCONN = server.createobject("adodb.connection")

*Set* myCONN = server.createobject("adodb.connection")

> myDSN = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
> server.mappath("/database/kassaa.mdb")
> myCONN.mode = 3 ' adModeReadWrite
> myCONN.Open myDSN

What additional information is carried by the prefix "my"?