Connect SQL database through ASP
From: Sheridan (anonymous_at_discussions.microsoft.com)
Date: 07/03/04
- Previous message: Lou Arnold: "Re: Communciation between MS SQL Server and client"
- Next in thread: Jacco Schalkwijk: "Re: Connect SQL database through ASP"
- Reply: Jacco Schalkwijk: "Re: Connect SQL database through ASP"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 3 Jul 2004 08:23:16 -0700
I have SQL Server 2000 installed on my machine and tried
to develop asp script to connect to the server database
(localhost). But I got invalid authorization error
message, any help will be greatly appreciated. Following
is my script:
<%Option Explicit%>
<html>
<head>
<title>Testing Connection1</title>
</head>
<body>
<%
Dim strConnectionString
strConnectionString = "Provider=SQLOLEDB.1;Data
Source=C:\Program Files\Microsoft SQL
Server\MSSQL\Data\Master.mdf"
Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
objConn.Open strConnectionString
strSQL = "SELECT First_Name, Last_Name FROM
Member_Master"
objRS.Open strSQL, objConn
Set objFirstName = objRS("First_Name")
Set objLastName = objRS("Last_Name")
Do Until objRS.EOF
Response.Write objFirstName & " " & objLastName
& "<BR>"
objRS.MoveNext
Loop
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>
</body>
</html>
------
Thanks,
Sheridan
- Previous message: Lou Arnold: "Re: Communciation between MS SQL Server and client"
- Next in thread: Jacco Schalkwijk: "Re: Connect SQL database through ASP"
- Reply: Jacco Schalkwijk: "Re: Connect SQL database through ASP"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|