Trying ot connect using .asp Vb Script
1. Sql server set to use Windows Authentication
2. Log onto Windows 2000 as Jim Bunton {no password)
3 Server 'Study' running ok
4. sql query analyser
i. "SELECT User_Name > dbo
ii. [using database NorthWind]
"SELECT * FROM Customers" > gives expected result
5. VB script
** BEGIN CODE connect.asp ***
<%
@. LANGUAGE="VBSCRIPT"
%
<%
Option explicit
response.expires = 0
%
<!-- #include file="adovbs.inc" --
<html>
<head>
<title></title>
</head>
<body>
<%
dim Cn, CnStr
Set Cn = Server.CreateObject("ADODB.Connection")
Cn.ConnectionTimeOut = 1
Cn.provider="sqloledb"
response.write "Conn Provider is " & Cn.provider
CnStr="Data Source=Study;Initial Catalog=Norhwind;User
Id=sa;Password=;"
' Tried all sorts of user id's and paswords
'CnStr="Data Source=Study;Initial Catalog=Norhwind;User Id =
'Jim Bunton';Password=;"
'CnStr="Data Source=Study;Initial Catalog=Norhwind;User Id
=dbo;Password=;"
'CnStr="Data Source=Study;Initial Catalog=Norhwind;User Id =
JimBunton;Password=;"
'CnStr="Data Source='Study';Initial Catalogue='Norhwind';User Id
='Study\Jim Bunton';Password=;"
%>
<p>----</p>
<%
response.write "Cnstr = " & CnStr
'ERROR ALWAYS OCCURS ON NEXT LINE
Cn.open CnStr
'Error Type:
'(0x80004005)
'Unspecified error
'/myweb/mywebs/connect.asp, line 35
%>
<p>----</p>
<%
response.write "The End - ran ok"
%
</body
</html
**** END CODE *****
? what to do??
?? am I missing something 'obvious' out ?
--
Jim BuntonJim Bunton (jBunton@.BlueYonder.co.uk) writes:
> Win 2000, sqlServer 2000 Personal edition
> Trying ot connect using .asp Vb Script
> 1. Sql server set to use Windows Authentication
> 2. Log onto Windows 2000 as Jim Bunton {no password)
You're a brave man!
> 'CnStr="Data Source='Study';Initial Catalogue='Norhwind';User Id
>='Study\Jim Bunton';Password=;"
That is not likely to be correct. User Id and Password is for SQL
authentication, and SQL logins usually don't have \ in them. To login
with Windows authentication, specify "Integrated Security=SSPI", or
Trusted_connect=Yes.
And spell Northwind correctly. :-)
--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp
No comments:
Post a Comment