Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Help - for connecting SQL Server7 by using OLE DB provider


Message #1 by "Michelle Lai" <mlai@w...> on Fri, 19 May 2000 18:51:57
I'm using example (recordset.asp and datastore.asp) in "Beginning Active 

Server Pages 3.0" to connect Database(Movie2000) in SQL Server7.  And I got 

the message:

HTTP 500.100 - Internal Server Error - ASP error Internet Information 

Services.  Error Type: Microsoft OLE DB Provider for SQL Server 

(0x80004005)[DBNMPNTW]Specified SQL server not found. 

/IISSamples/sdk/asp/database/Recordset.asp, line 20



Here are the code for recordset.asp 

<%

  Option Explicit

  Dim strConnect

%>

<!-- #include file="DataStore.asp" --> 

<HTML>

<HEAD>

<TITLE>ADO Recordset Object</TITLE>

</HEAD>

<BODY>



<%

  Dim objRS

  Const adOpenForwardOnly = 0

  const adLockReadOnly = 1

  Const adCmdTable = 2

  

  Set objRS = Server.CreateObject("ADODB.Recordset")



  objRS.Open "Movies", strConnect, adOpenForwardOnly, adLockReadOnly, 

adCmdTable



  Do until objRS.EOF

    Response.Write objRS("Title") & "<BR>"

    objRS.MoveNext

  Loop



  objRS.Close

  Set objRS = Nothing



%>



</BODY>

</HTML>



----



and the code for datastore.asp:

<%

  Dim strDatabaseType



  'Choose one of the following two lines, and comment out the other 

  'strDatabaseType = "Access"

   strDatabasetype ="SQLSERVER"

 

  'Now we use this selection to specify the connection string

  If strDatabaseType = "Access" Then

    strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & _

                 "Data 

Source=c:\inetpub\iissamples\sdk\asp\database\Movie2000.mdb;" & _

                 "Persist Security Info=False"

  Else

    strConnect = "Provider=SQLOLEDB;Data Source 

=d:\MSSQL7\Data\Movie2000_Data.mdf" & _

                 "Database =Movie2000;User ID=sa;password=" 

  End If 

%>



p.s. I have no problem connect to Access....


  Return to Index