473,405 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Connecting ASP to MS SQL SERVER 2000

46
Frankly speaking, I got much help from Experts CrowCrew, DrBuchman and others when I was learning ASP with MS ACCESS as backend.

When I was using ASP With Access Database, I was using the following codes for connection with the Access Database which resides in the inetpub/wwwroot folder.
Expand|Select|Wrap|Line Numbers
  1. <%
  2. 'declare variables
  3. dim conn, rs, x
  4. 'set connection to database
  5. set conn=Server.CreateObject("ADODB.Connection")
  6. conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& Server.MapPath("../yeshti.mdb")
  7. 'create recordset
  8. set rs=Server.CreateObject("ADODB.Recordset")
  9. rs.Open "SELECT serial,make,model,eng_cap from toyota WHERE active='Y' ORDER BY Serial", conn
  10. %>
  11.  
Now I wish to replace MS Access for MS SQL as backend. I have successfully installed MS SQL Server 2000 on my PC running Windows XP.

I have used the Data Transformation Service Import/Export Wizard to import the data from MS Access to MS SQL Server.

I have put login and password for user authentication at the ASP program level. I do not want to put any restriction at the server level.

Could any one please help me connect to the SQL Server and display the information found in the table I have chosen.
Jun 18 '08 #1
4 3406
DrBunchman
979 Expert 512MB
Hi giandeo,

Rather than connecting to a database file as you do with Access you need to connect to your server and specify the database which you are going to use. Let's change your connection string to something like the following:
Expand|Select|Wrap|Line Numbers
  1. conn.Open "Provider=SQLOLEDB; Data Source=YOUR_SERVER_NAME; Initial
  2. Catalog=your_database_name; User ID=your_username; Password=your_password"
For more information about connection strings with MS SQL take a look at this.

The general syntax for the SQL is very similar between Access and MS SQL and you should find your query above works without any problems.

Let us know if you are able to connect using the above connection string as an example. If it fails then please print the errors here so we can take a look.

Hope this helps,

Dr B
Jun 18 '08 #2
giandeo
46
Hello Dr. B

Sorry Sir, I could not reply for so long because I was ill.

I have tried the codes you suggested, but unfortunately, I could not create a connection to the MS SQL Server.

Here are my codes:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <%
  3. 'declare variables
  4. dim conn, rs, x
  5. 'set connection to database
  6. set conn=Server.CreateObject("ADODB.Connection")
  7. conn.Open "Provider=SQLOLEDB; Data Source=(local); Initial Catalog=yeshti; User ID=;Password=;"
  8.  
  9. 'create recordset
  10. set rs=Server.CreateObject("ADODB.Recordset")
  11. rs.Open "SELECT serial,make,model,eng_cap from toyota WHERE active='Y' ORDER BY Serial", conn
  12. %>
  13.  
I have not put any password or login at the Server Level.

The following errors were reported:

Error Type:
Microsoft OLE DB Provider for SQL Server (0x80004005)
Invalid authorization specification
/shv/test.asp, line 6

Please give me your suggestion.....
Thanks
Jun 23 '08 #3
DrBunchman
979 Expert 512MB
When you say that you have not put any password or login at the Server Level, does that mean you are using Windows Authentication to log on rather than SQL Server Authentication?

If so, or if you are not sure, then try the following:
Expand|Select|Wrap|Line Numbers
  1.  
  2. conn.Open "Provider=SQLOLEDB; Data Source=(local); Initial Catalog=yeshti; Integrated Security=SSPI;"
  3.  
You'll need to disable Anonymous Access on your webpage through the IIS and enable Windows Authentication. Doing this means that the IIS will pass your log in credentials to the SQL Server.

Let me know if this works.

Dr B
Jun 23 '08 #4
wat if i m using windows authentication only
Oct 7 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: JA | last post by:
Hi, I am total newbie to SQL Server. My new host tells me I can connect through AccessXP or 2002. I have Access 2000. Can I not connect with that also? Thanks, JA
3
by: Ann Marinas | last post by:
Hi there, I am currently developing an ASP.NET program that connects to a SQL Server 2000 database. I also have SQL Server 2005 Express installed on the same local machine. Prior to...
9
by: RvGrah | last post by:
After much hair-pulling, I've finally found the answer to a problem that many are fighting with, difficulty connecting from Sql 2005 Server Management or VS2005 to a remote Sql Server running Sql...
3
by: Vinod R.Shenoy | last post by:
Hi All, Came across a post wherin you had helped somebody with a similar problem and was wondering if you could help us out with it. Our problem is , We have a development SQL Server 2000...
3
by: Chris | last post by:
Don't know if there is a simple solution for this one or not. When running SQL server on a machine with 2000 loaded and the complete SQL package I don't have any issues. Now I'm trying to login...
6
by: Todd Brewer | last post by:
Windows Server 2000 ASP.NET 2.0 SQL Server 2000 (on a physically seperate server) I moved an ASP.NET 2.0 application from a development server to production, and am getting the following error:...
1
by: =?Utf-8?B?TmVpbCBQYWRkb2Nr?= | last post by:
Using asp.net in Visual Studio 2005, we are getting an error message when trying to connect to an existing SQL 2000 database.. This has only hapenned since we installed the SQL 2005 client tools....
7
by: TerpZebra | last post by:
I am having difficulty connecting to SQL Server 2000 on one of our servers via a VB6 program on Vista. I can connect fine to a different server, but it gives me the following error with the server...
3
by: Me LK | last post by:
I did a search but could not find an aswer that worked so here it goes. I just did an upgrade from 2003 to vs 2005 express. I am using a remote sql server 2000. I specifically upgrade to make...
2
by: orandov | last post by:
Hi, I am having a problem connecting my .net applications from the application server to the database server. When I run the application from my windows xp (sp2) box it works fine. When I try to...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.