Hi, if any one could helpme here,
I am trying to connect to one oof my databases in SQL 2000 server through ASP using similasr coode:
<% @.LANGUAGE = VBSCRIPT %>
<% Option Explicit %>
<html>
<head>
<title>testing our connection</title>
</head>
<body>
<%
Dim adOpenForwardOnly, adLockReadOnly, adCmdTable
adOpenForwardOnly = 0
adLockReadOnly = 1
adCmdTable = 2
Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
' the following connection string is for connecting to a local SQL Server 2000 database
objConn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;" & _
"User ID=sa;Password=tdmes102;Initial Catalog=CustomerProfile;" & _
"Data Source=dani;" & _
"Initial File Name=D:\DB\TDMECustomer_Data.MDF"
' the following connection string is for connecting to a remote SQL Server 2000 database
objRS.Open "CustomerProfile", objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable
While Not objRS.EOF
Response.Write objRS("Principal") & "<BR>"
objRS.MoveNext
Wend
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>
</body>
</html>
I have tried several diferent ways and I keep getting this foollowing messages the same in the log file.
I tried relocating the database,reinstalling SQL , sp2.
HTTP error:
FCB::Open failed: Could not open device D:\DB\TDMECustomer_Data.MDF for virtual device number (VDN) 0.
SQL log file:
udopen: Operating system error 32(The process cannot access the file because it is being used by another process.) during the creation/opening of physical device D:\DB\TDMECustomer_Data.MDF.
2002-07-15 09:46:59.11 spid51 FCB::Open failed: Could not open device D:\DB\TDMECustomer_Data.MDF for virtual device number (VDN) 0.You don't supply an Initial File Name, maybe something you use for Access but not for SQL Server. At our site we don't even use the Data Source parameter, we add a Server parameter instead.
Here is a website that has connection examples
ConnectionString (http://www.connectionstrings.com/index.htm)
Example
Standard Security:
"Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;User Id=sa;Password=asdasd;")
Trusted Connection:
"Provider=sqloledb;Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;"
Provider=SQLOLEDB.1;Persist Security Info=False;" & _
"User ID=sa;Password=tdmes102;Initial Catalog=CustomerProfile;" & _
"Data Source=dani;
Wednesday, March 21, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment