P
Peter Morris
Newbie question, I'm just learning ASP
I am having trouble connecting to a database. I have set up the
ODBC data source Northwind to link to the Northwind database.
Now, I'm running the following script:
<% @language = vbscript %>
<%
Option explicit
Response.expires = 0
dim objConn, objRS, strQuery
dim strConnection
Set ObjConn = server.createObject("ADODB.connection")
strConnection = "DSN=Northwind;database=northwind;"
strConnection = strConnection & "UID=sa;PWD=;"
objConn.open strConnection
....
%>
This produces the following error:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user
'YOUR-D10B605044\IUSR_YOUR-D10B605044'.
/asp24/hour13/readdata.asp, line 10
Why is this happening? Why can't I connect?
Note - there doesn't seem to be anything wrong with the database or the
DSN. I have created a visual basic program which successfully opens
and reads the same database and DSN. This connects like so:
Dim cnn1 As ADODB.Connection
Dim rstRec As ADODB.Recordset
Dim strCnn As String
Sub main()
Set cnn1 = New ADODB.Connection
strCnn = "DSN=Northwind;Database=Northwind;UID=sa;PWD=;"
cnn1.Open strCnn
End Sub
Why does it work in visual basic, but not in VBScript? Is there
perhaps something I must configure in IIS for it to work, or something
like that?
--
_______________________
/_____________________(_)
| ______________________ email to
| | |__________________(_) Peter_Morris_1 at
| |/____________________ btinternet dot com
|_____________________(_)
I am having trouble connecting to a database. I have set up the
ODBC data source Northwind to link to the Northwind database.
Now, I'm running the following script:
<% @language = vbscript %>
<%
Option explicit
Response.expires = 0
dim objConn, objRS, strQuery
dim strConnection
Set ObjConn = server.createObject("ADODB.connection")
strConnection = "DSN=Northwind;database=northwind;"
strConnection = strConnection & "UID=sa;PWD=;"
objConn.open strConnection
....
%>
This produces the following error:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user
'YOUR-D10B605044\IUSR_YOUR-D10B605044'.
/asp24/hour13/readdata.asp, line 10
Why is this happening? Why can't I connect?
Note - there doesn't seem to be anything wrong with the database or the
DSN. I have created a visual basic program which successfully opens
and reads the same database and DSN. This connects like so:
Dim cnn1 As ADODB.Connection
Dim rstRec As ADODB.Recordset
Dim strCnn As String
Sub main()
Set cnn1 = New ADODB.Connection
strCnn = "DSN=Northwind;Database=Northwind;UID=sa;PWD=;"
cnn1.Open strCnn
End Sub
Why does it work in visual basic, but not in VBScript? Is there
perhaps something I must configure in IIS for it to work, or something
like that?
--
_______________________
/_____________________(_)
| ______________________ email to
| | |__________________(_) Peter_Morris_1 at
| |/____________________ btinternet dot com
|_____________________(_)