Aykut Canturk wrote:
Can I use SqlExpress2005 AttachDatabase feature with classic ADO
connections in my .asp pages ?
I've never done it, but it is supposedly possible
But I need ConnectionStrin g. Although I searched
the web for couple of weeks I still coulnd't find any solution.
anybody succeeded to use classic ado with attach feature without
attaching database filed from enterprise manager ? I want tou use SQL2005
and I
don't want directly attch files to sql.
Best regards...
<%
set cn = Server.CreateOb ject("ADODB.Con nection")
' THIS ConnectionStrin g IS WRONG of course. I need correct and
working one
ConnectionStrin g=
"Provider=SQLNC LI;Server=.\SQL Express;AttachD bFilename=c:\db \mydbfile.mdf;T rusted_Connecti on=Yes;"
From
www.connectionstrings.com:
*************** *************** *************** *************** *************
Attach a database file on connect to a local SQL Server Express
instance:
Driver={SQL Native
Client};Server= .\SQLExpress;At tachDbFilename= c:\asd\qwe\mydb file.mdf;
Database=dbname ;Trusted_Connec tion=Yes;
Why is the Database parameter needed? If the named database have
already been attached, SQL Server does not reattach it. It uses the attached
database as the default for the connection.
Attach a database file, located in the data directory, on connect to a
local SQL Server Express instance:
Driver={SQL Native
Client};Server= .\SQLExpress;At tachDbFilename= |DataDirectory| mydbfile.mdf;
Database=dbname ;Trusted_Connec tion=Yes;
Why is the Database parameter needed? If the named database have
already been attached, SQL Server does not reattach it. It uses the attached
database as the default for the connection.
*************** *************** *************** *************** *************
FWIW, I've had issues connecting to SQL 2005 databases from ASP using
trusted connections. I have had to create a SQL login and use it in my
connection strings.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"