|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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) |
|
#2
|
|||
|
|||
|
try this remove the password and in the username field type in sa and see if it will connect then
![]()
__________________
Apache Expert |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft SQL Server > connecting to a sql database |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|