Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 12th, 2002, 07:21 PM
coraxal coraxal is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 4 coraxal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry connecting to a sql database

Hello guys...I'm migrating to SQL 2000 and ASP having C/C++ background....I need to develop a project for my work....I need to develop a simple ASP module which will connect to a simple SQL 2000 database.....let's say that this database has only three columns...lastN, middleN, and firstN (really basic database)....what I'm trying to accomplish is the following....1) be able to connect to the database from an ASP page 2) ASP page should allow to manipulate database records (really simple functions such as add, modify, delete records)...like i said I'm kinda new at this....I tried to make the connection but it didnt work...this is what i did....I made my connection in the global.asa as follows

---global.asa----

<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub Application_OnStart()
Dim strConn
strConn = "Provider=SQLOLEDB.1; Data Source=servername; Initial Catalog=databasename; User Id=username; Password=password"
Application("strConn") = strConn
End Sub
</Script>

---test.asp--this page is not trying to do any functions other than making the connection to the database and displaying records

1 <% Option Explicit %>
2 <html>
3 <head>
4 <title>test asp page</title>
5 </head>
6 <body>
8 <ol>
9 <%
10 Dim objConn
11 Set objConn = Server.CreateObject("ADODB.Recordset")
12 objConn.Open "table's name", Application("strConn")
13
14 Do While Not objConn.EOF
15 Response.Write "<li><b>" & objConn("lastN") & "</b>"
16 Response.Write "<p>" & objConn("firstN") & "</p></li>"
17 objConn.MoveNext
18 Loop
19 If objConn.BOF Then
20 Response.Write "<p>No more records in the database!</p>" & vbNewLine
21 End If
22
23 objConn.Close
24 %></ol>
25 </body>
26 </html>

I know that you guys will look at this and it'll be a simple problem...once again...im only a newbie at this..so any help would be greatly appreciated....maybe someone can point me in the right direction.....Thanks!

P.S. what I'm trying to accomplish here....is to connect a simple database to a page and show the records of that database (only 3 names stored in the database)

Reply With Quote
  #2  
Old November 30th, 2002, 06:22 AM
infamous-online infamous-online is offline
Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Posts: 404 infamous-online User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 24 m 44 sec
Reputation Power: 7
try this remove the password and in the username field type in sa and see if it will connect then
__________________
Apache Expert

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > connecting to a sql database


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT