Monday, March 26, 2012

how to connect to MDF file with classic ASP?

You might want to have a look at some of these:
http://msdn2.microsoft.com/en-us/library/ms345154.aspx Express Overview
http://msdn2.microsoft.com/en-us/library/ms165672.aspx Comparing Express
with MSDE
http://msdn.microsoft.com/sql/default.aspx?pull=/library/en-us/dnsse/html/sqlexpuserinst.asp
User Instances
http://www.datamasker.com/SSE2005_NetworkCfg.htm Configuring Express
for Remote Access
https://blogs.msdn.com/sqlexpress/archive/2005/05/05/415084.aspx
Configuring Remote Access
http://www.kbalertz.com/Feedback_914277.aspx Configuring SQL2005 for
remote access
http://msdn.microsoft.com/sql/express/default.aspx?pull=/library/en-us/dnsse/html/emsqlexcustapp.asp
Embedding Express in Apps
http://www.microsoft.com/downloads/details.aspx?FamilyID=c243a5ae-4bd1-4e3d-94b8-5a0f62bf7796&DisplayLang=en
SSMS Express
http://blogs.msdn.com/rogerwolterblog/archive/2006/04/13/575974.aspx
Backing up Express
Andrew J. Kelly SQL MVP
"Bart" <b@.sdq.dc> wrote in message
news:%23%23w0O9RbHHA.3584@.TK2MSFTNGP02.phx.gbl...
> Hi,
> i have already posted this problem in an ASP newsgroup without succes, so
> i try here.
> I try to access within an cliassic ASP page an MDF file (newres.mdf) of
> sql server express 2005 database which is located in
> c:\inetpub\wwwroot\reskrosql\App_Data.
> I get following error :
> Provider error '80040e21'
> Multiple-step OLE DB operation generated errors. Check each OLE DB
> status value, if available. No work was done"
> The code in ASP file:
> --
> <%
> set objdc = Server.CreateObject("ADODB.Connection")
> objdc.Open(application("newres")) 'error line
> %>
> global.asa:
> --
> Sub Application_OnStart
> Application("newres") =
> "Provider=SQLOLEDB;DATABASE=c:\inetpub\wwwroot\res krosql\App_Data\newres.mdf;Data
> Source=.\SQLEXPRESS;AttachDbFilename=c:\inetpub\ww wroot\reskrosql\App_Data\newres.mdf;Integrated
> Security=True;User Instance=True"
>
> 'i also tried this:
> Sub Application_OnStart
> Application("newres") = "Provider=SQLOLEDB;DATABASE=newres;Data
> Source=.\SQLEXPRESS;AttachDbFilename=c:\inetpub\ww wroot\reskrosql\App_Data\newres.mdf;Integrated
> Security=True;User Instance=True"
> End Sub
> Thanks for help
> Bart
>
>
Well to be honest I am not sure if classic ASP can access SQL Express or
not. I don't mess with express much but the first link did say there was
some issues with earlier versions of MDAC and connecting under certain
conditions. Look here under Data Access section:
http://msdn2.microsoft.com/en-us/library/ms345154.aspx
In the below link it goes into great detail about connecting using
AttachDBFileName but not necessarily with classic ASP.
http://msdn2.microsoft.com/en-us/library/bb264564.aspx
Have you tried this with .net and or the SNAC driver to see if you can get
it to work at all yet?
Andrew J. Kelly SQL MVP
"Bart" <b@.sdq.dc> wrote in message
news:epUZNiXbHHA.260@.TK2MSFTNGP02.phx.gbl...
> Thanks Andrew,
> to be honest, i read all of them but could not find an example of a
> connectionstring for ASP using AttachDbFilename
> and i'm getting fed up to read and search for 2 days something that is not
> even so particular. I get the impression that it's the first time someone
> try this ...
> What i noticed is that when i change the connectionstring with a false
> path, like:
> "Provider=SQLOLEDB;Data
> Source=.\SQLEXPRESS;AttachDbFilename=c:\WRONGPATH; Integrated
> Security=True;User Instance=True"
> i still get the same error. Maybe the problem is elsewhere
>
>
|||AttachDBFilename should work from OLEDB or ODBC but the User instance clause
is only available from SQLClient - ADO.Net so it's not clear how much good
AttachDBFilename will do you.
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Bart" <b@.sdq.dc> wrote in message
news:epUZNiXbHHA.260@.TK2MSFTNGP02.phx.gbl...
> Thanks Andrew,
> to be honest, i read all of them but could not find an example of a
> connectionstring for ASP using AttachDbFilename
> and i'm getting fed up to read and search for 2 days something that is not
> even so particular. I get the impression that it's the first time someone
> try this ...
> What i noticed is that when i change the connectionstring with a false
> path, like:
> "Provider=SQLOLEDB;Data
> Source=.\SQLEXPRESS;AttachDbFilename=c:\WRONGPATH; Integrated
> Security=True;User Instance=True"
> i still get the same error. Maybe the problem is elsewhere
>
>
|||Depends on how you define impossible. You can't access it using the
connection string you are trying to use because only ADO.Net understands the
Userinstance parameter. You can definitely attach it to SQL Express and
access it the way you would any other database. You can also access it
through the named pipe name but that's not something I would recommend for a
production system. More information on user instances is available here:
http://msdn2.microsoft.com/en-us/library/bb264564.aspx
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Bart" <b@.sdq.dc> wrote in message
news:%23kiVRyZbHHA.4832@.TK2MSFTNGP02.phx.gbl...
> Thanks, so the conclusion is:
> it's impossible to access a MDF file with classic asp?
> "Roger Wolter[MSFT]" <rwolter@.online.microsoft.com> schreef in bericht
> news:EF1406A3-C657-44F9-8FF6-3F1D032175E1@.microsoft.com...
>
sql

No comments:

Post a Comment