Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 12th, 2004, 12:22 PM
Registered User
 
Join Date: Jan 2004
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 12 problem

Hello.

I am new to ASP and have used Beginning ASP 3.0 without any real problems up to now.

I am trying to access the Movie Database but keep getting the following error:

Error Type:
ADODB.Connection (0x800A0E7A)
Provider cannot be found. It may not be properly installed.
/aspfiles/connect.asp, line 28


This is the code from the referenced location:

if strDatabaseType = "Access" then
        objConn.Open "Provider=Microsoft.Jet.OLEDB 4.0;" & "Data Source=C:\datastores\Movie2000.mdb;" &_
        "Persist Security Info=False"
    else
        objConn.Open "Provider=SQLOLEDB;Persist Security Info=False;" & "User ID=sa;Initial Catalog=Movie;" &_
        "Initial File Name=c:\MSSQL7\Data\Movie2000.mdf"
    end if

I checked to see if I could find the Jet driver or how to activate it but no luck. I double and triple-checked the code but there seem to be no errors.

Any suggestions?

Thanks,
JB977
  #2 (permalink)  
Old January 12th, 2004, 12:39 PM
Imar's Avatar
Wrox Author
Points: 72,035, Level: 100
Points: 72,035, Level: 100 Points: 72,035, Level: 100 Points: 72,035, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,079
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi JB977,

I think you're missing a . between OLEDB and 4.0. AFAIK, it should look like this:

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\YourDatabase.mdb;User Id=admin;Password="

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #3 (permalink)  
Old January 12th, 2004, 05:06 PM
Registered User
 
Join Date: Jan 2004
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Imar
 Hi JB977,

I think you're missing a . between OLEDB and 4.0. AFAIK, it should look like this:

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\YourDatabase.mdb;User Id=admin;Password="

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Thanks Imar,

Turns out that was exactly what it was! I found that out after posting and looked even closer at my code.

Just goes to show that when programming make sure you "dot your I's and cross your T's"

Hope anyone else who posts double checks as well!

Thanks again hopefully next time I post I will have a "real" problem ;)

Thanks,
JB977
  #4 (permalink)  
Old March 3rd, 2004, 08:31 AM
Authorized User
 
Join Date: Sep 2003
Location: London, , United Kingdom.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Jams30
Default

Hi

I'm also having similar problems as below, although the difference being that I'm trying to connect to MSDE. I am running Windows 2000 and IE 6, I have managed to successfully installed MSDE as per the instructions in the book but still seem to be having problems. My script debugger tells me that there is an unspecified error - on closing the debugger, connect.asp displays the following:

HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

--------------------------------------------------------------------------------

Technical Information (for support personnel)

Error Type:
(0x80004005)
Unspecified error
/BegASP/connect.asp, line 29


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

Page:
GET /BegASP/connect.asp

Any help on this would be most appreciated.

Thanks in advance


Jamal



  #5 (permalink)  
Old March 3rd, 2004, 08:46 AM
Imar's Avatar
Wrox Author
Points: 72,035, Level: 100
Points: 72,035, Level: 100 Points: 72,035, Level: 100 Points: 72,035, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,079
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Can you post the relevant parts of the code?

Also, make sure friendly http error messages are off (although I am not sure you posted a friendly or an unfriendly message ;)). For the browser (IE), open the Options panel, switch to the Advanced tab and disable Show friendly HTTP error messages. For IIS, open your site, click the Configuration button on either the Directory or Home Directory tab, and then switch to the Debugging tab. Make sure that Send detailed ASP error messages to client is checked.



Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #6 (permalink)  
Old March 3rd, 2004, 09:00 AM
Authorized User
 
Join Date: Sep 2003
Location: London, , United Kingdom.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Jams30
Default

Hi Imar

Thanks for your quick response, I have checked that the option in the advanced tab is set to disable friendly error messages and also the send detailed error messages to the client is also enabled, my code is as follows:

<%Option Explicit%>
<HTML>
<HEAD>
<TITLE>Testing our connection</TITLE>
</HEAD>
<BODY>

<%
Dim adOpenForwardOnly, adLockReadOnly, adCmdTable
adOpenForwardOnly = 0
adLockReadOnly = 1
adCmdTable = 2

Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")

Dim strDatabaseType
'Choose one of the following two lines, and comment out the other
'strDatabaseType = "Access"
'strDatabaseType = "MSDE"

'Now we use this selection to open the connection in the appropriate way
If strDatabaseType = "Access" Then
  objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
               "Data Source=C:\datastores\Movie2000.mdb;" & _
               "Persist Security Info=False"
Else
  objConn.Open "Provider=SQLOLEDB;Persist Security Info=False;" & _
               "User ID=sa;Initial Catalog=Movie;" & _
               "Initial File Name=C:\MSSQL7\Data\MovieMSDE.mdf"
End If

objRS.Open "Movies", objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable

While Not objRS.EOF
  Response.Write objRS("Title") & "<BR>"
  objRS.MoveNext
Wend

objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>

</BODY>
</HTML>

I hope this is of some help to you.

Thanks again

Jamal





Quote:
quote:Originally posted by Imar
 Hi there,

Can you post the relevant parts of the code?

Also, make sure friendly http error messages are off (although I am not sure you posted a friendly or an unfriendly message ;)). For the browser (IE), open the Options panel, switch to the Advanced tab and disable Show friendly HTTP error messages. For IIS, open your site, click the Configuration button on either the Directory or Home Directory tab, and then switch to the Debugging tab. Make sure that Send detailed ASP error messages to client is checked.



Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #7 (permalink)  
Old March 3rd, 2004, 04:51 PM
Imar's Avatar
Wrox Author
Points: 72,035, Level: 100
Points: 72,035, Level: 100 Points: 72,035, Level: 100 Points: 72,035, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,079
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Right, I think I see the problem.

You are linking to an MDF file for the MSDE installation:

objConn.Open "Provider=SQLOLEDB;Persist Security Info=False;" & _
  "User ID=sa;Initial Catalog=Movie;" & _
  "Initial File Name=C:\MSSQL7\Data\MovieMSDE.mdf"

However, this is not correct. You'll need to link to a server and a database, not a file name.
Try this instead:

oConn.Open "Provider=sqloledb;" & _
           "Data Source=YourServerName;" & _
           "Initial Catalog=Movie;" & _
           "User Id=SA;" & _
           "Password="

So, you don't need the Initial Filename, but you do need a datasource. This is usually the name of the server. If you have a "Named Instance", you should use the format ServerName\InstanceName, for example MyServer\VSDotNet

You should put a password on your MSDE SA account, and then connect to the database with another account (also with a password). Using SA without a password is not very recommended.

Cheers,

Imar



---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #8 (permalink)  
Old March 4th, 2004, 10:36 AM
Authorized User
 
Join Date: Sep 2003
Location: London, , United Kingdom.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Jams30
Default

Hi Imar

Thanks again - but unfortunately the problem persists! I'm fairly new to ASP so what you suggested as below I copied, pasted and amended my code so it now looks like this:

Dim strDatabaseType
'Choose one of the following two lines, and comment out the other
'strDatabaseType = "Access"
strDatabaseType = "MSDE"

'Now we use this selection to open the connection in the appropriate way
If strDatabaseType = "Access" Then
  objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
               "Data Source=C:\datastores\Movie2000.mdb;" & _
               "Persist Security Info=False"
Else
objConn.Open "Provider=SQLOLEDB.1;" & _
           "Data Source=Localhost;" & _
           "Initial Catalog=Movie;" & _
           "User Id=sa;" & _
           "Password="
End If





objRS.Open "Movies", objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable

While Not objRS.EOF
  Response.Write objRS("Title") & "<BR>"
  objRS.MoveNext
Wend

objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing


However this is still giving me the same errors as before! Once again, any advice would be appreciated a lot!

Jamal




Quote:
quote:Originally posted by Imar
 Right, I think I see the problem.

You are linking to an MDF file for the MSDE installation:

objConn.Open "Provider=SQLOLEDB;Persist Security Info=False;" & _
"User ID=sa;Initial Catalog=Movie;" & _
"Initial File Name=C:\MSSQL7\Data\MovieMSDE.mdf"

However, this is not correct. You'll need to link to a server and a database, not a file name.
Try this instead:

oConn.Open "Provider=sqloledb;" & _
         "Data Source=YourServerName;" & _
         "Initial Catalog=Movie;" & _
         "User Id=SA;" & _
         "Password="

So, you don't need the Initial Filename, but you do need a datasource. This is usually the name of the server. If you have a "Named Instance", you should use the format ServerName\InstanceName, for example MyServer\VSDotNet

You should put a password on your MSDE SA account, and then connect to the database with another account (also with a password). Using SA without a password is not very recommended.

Cheers,

Imar



---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #9 (permalink)  
Old March 4th, 2004, 11:51 AM
Imar's Avatar
Wrox Author
Points: 72,035, Level: 100
Points: 72,035, Level: 100 Points: 72,035, Level: 100 Points: 72,035, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,079
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Can you connect to your SQL Server using something like SQL Server Enterprise Manager?
If so, what server name are you using? Are you sure you have a default MSDE installation that listens to localhost and not localhost\InstanceName ?

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #10 (permalink)  
Old March 5th, 2004, 09:11 AM
Authorized User
 
Join Date: Sep 2003
Location: London, , United Kingdom.
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Jams30
Default

Hi

I'm really not too sure on the questions below - basically, I have followed the instructions of chapter 12 in the book to the letter up to page 475 - at the first try it out is where I'm getting these problems. I have checked to see if my code works connecting to an Access database as supplied in the code downloads and this is all fine. I am not running anything like SQL Server Enterprise Manager.

I'm sorry to be as vague as I've been, this is all a bit new to me and so my understanding of it all is a bit sketchy at the moment!!

Once again, many thanks for your time.

Jamal




Quote:
quote:Originally posted by Imar
 Can you connect to your SQL Server using something like SQL Server Enterprise Manager?
If so, what server name are you using? Are you sure you have a default MSDE installation that listens to localhost and not localhost\InstanceName ?

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in Chapter 12 JamesY BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 July 11th, 2006 03:49 PM
Chapter 12 - $_POST['redirect'] problem cshu BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 4 July 25th, 2005 08:14 PM
Chapter 12 Code Behind Problem locknload7 BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 1 March 30th, 2005 10:34 AM
Problem with Excel VBA Chapter 12 RogerWaters Excel VBA 0 September 22nd, 2003 10:13 AM
Chapter 12 problem Please help rsteph7 Beginning PHP 2 July 16th, 2003 02:02 PM



All times are GMT -4. The time now is 03:17 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.