Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
|
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 8th, 2006, 10:17 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default accessing MS SQL DB from Classic ASP script

I have created a MS SQL DB called 'PiccoCeraci'.
It is running on my local machine.

I have this script, called MSSQL.asp:

Code:
<html>
<title>Queries from the MS-SQL database with ASP</title>
<body bgcolor="FFFFFF">
<h2>Query from table <b>products</b> with ASP</h2>

<%

Set conn = Server.CreateObject("ADODB.Connection")
conn.open "PROVIDER=SQLOLEDB;DATABASE=PiccoCeraci"

'This code block will create a recordset
Set rs = Server.CreateObject("ADODB.Recordset")
SQL = "select * from products"
rs.open SQL, conn

'will iterate to display the records got from the database
While Not rs.EOF
  response.write(rs("id") & " " & rs("price"))
  rs.MoveNext
Wend

'closes the connection
rs.close
conn.close
Set rs = Nothing
Set conn = Nothing

%>
</body>
</html>
When i run the script in IE7, i get this error:

Microsoft OLE DB Provider for SQL Server error '80040e4d'

Login failed for user 'Craig R Morton'.

/picco/MSSQL.asp, line 9

When i test the data source in the Administrative Tools>Data Sources (ODBC) in the Control Panel i get this:

================================================== ===
Microsoft SQL Server ODBC Driver Version 03.85.1117

Running connectivity tests...

Attempting connection
Connection established
Verifying option settings
Disconnecting from server

TESTS COMPLETED SUCCESSFULLY!
================================================== ===

However, it asks 'How should SQL Server verify the authenticity of the login ID? I have selected 'With Win NT authentication' as the connectivity tests fail with the other option 'login id and password will be entered by the user'......which i want?

How can i set the u/name and p/word for this DB? and get it to run in my script?

Thanks in advance.

Picco


www.crmpicco.co.uk
www.ie7.com
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old May 31st, 2006, 09:33 AM
Authorized User
 
Join Date: May 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The user account that that IIS uses is not your user account.

 
Old June 1st, 2006, 03:43 PM
Registered User
 
Join Date: Jun 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

try this, replace the connection string

conn.open="PROVIDER=SQLOLEDB;DATABASE=PiccoCeraci; Database=<databasename>; UID=<username>;PWD=<password>"

username should be the one created in the SQL Server like sa.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing a .NET DLL from Classic ASP crmpicco ASP.NET 1.0 and 1.1 Basics 11 September 9th, 2007 09:51 PM
How to read MS Word content from Classic ASP AcidBurn Classic ASP Professional 1 May 25th, 2007 06:51 AM
How to read MS Word content from Classic ASP AcidBurn Classic ASP Components 1 May 25th, 2007 06:51 AM
MS ACCESS 2003 FRONTEND AND MS SQL SERVER 2005 DB mohankumar0709 SQL Server 2005 3 March 23rd, 2007 12:48 AM
script to open db to ms word? weedee Classic ASP Databases 5 June 2nd, 2005 04:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.