Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > BOOK: Beginning ASP 3.0
Password Reminder
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 March 11th, 2004, 01:35 PM
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 chapter 14 Try It Out problem - update

Hi

I'm having problems with the try it out on page 588 of the book. I have changed the value of strDatabaseType DataStore.asp to SQLServer but nothing else.

When trying to view the contents of StoredProcParam.asp in my browser, my debugger displays the error message - An external object raised an error. No error description available On closing the dialogue containing this error, the debugger ten displays the following script(with an arrow pointing to my highlighted line here):

<%
  Dim objRS, objComm, objParam, strDirector
  Set objComm = Server.CreateObject("ADODB.Command")

  objComm.ActiveConnection = strConnect ' fill in the command properties
  objComm.CommandText = "usp_FilmsByDirector"
  objComm.CommandType = adCmdStoredProc

  ' now the parameters (actually, there's only one parameter here)
  Set objParam = _
     objComm.CreateParameter("@Director", adVarChar, adParamInput, 50)
  objComm.Parameters.Append objParam

  strDirector = "Quentin Tarantino" ' you can change this if you like
  objComm.Parameters("@Director") = strDirector

  Set objRS = objComm.Execute ' execute the command and generate the recordset

  Set objComm = Nothing ' don't need the Command and Parameter objects
  Set objParam = Nothing ' ... so we can clean them up

  Response.Write "<H2>Films by " & strDirector & ":</H2>"
  While Not objRS.EOF ' now loop through the records
    Response.Write objRS("Title") & ", directed by " & objRS("Director") & "<BR>"
    objRS.MoveNext
  Wend

  objRS.Close ' now close and clean up
  Set objRS = Nothing
%>

I have tried this same excercise with an Access database and it works fine - so I'm wondering if its anything to do with the connection string as follows:

    strConnect = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=jamal;Initial Catalog=Movie;Data Source=THIN-MCH1WYA8P2;Initial File Name=C:\MSSQL7\Data\MovieMSDE.mdf"

This exact string has worked with previous examples that have been based on the same .mdf file.

When viewing the database via Access I do not see a stored procedure (usp_FilmsByDirector)in it and am wondering if this is also part of the problem?

Also can anyone tell me where I can get the .ADP file that is referred to in the book s being downloadable from this site.


Any help on this would be most appreciated as I cannot see where the problem lies!


Jamal
  #2 (permalink)  
Old March 22nd, 2004, 12:59 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi Jamal,

You have a pretty messed up connection string for connection to a SQL Server database.
First of all, you can't use a User ID and a Password in combination with "Integrated Security=SSPI". That is, you're either using Integrated (Windows) Security, or SQL Server Security. Only in the latter case, you should pass the user name and password.
Secondly, you can't connect to an MDF file; you have to connect to an Initial Catalog (the name of the database) and a Data Source (the name of the server).

All in all, you should end up with something like this:

strConnect = "Provider=sqloledb;" & _
           "Data Source=THIN-MCH1WYA8P2;" & _
           "Initial Catalog=Movie;" & _
           "Integrated Security=SSPI"

Is THIN-MCH1WYA8P2 the name of your SQL Server? Is it running a "real" SQL Server or the MSDE? If you're using MSDE, does your installation have a instance name?

HtH,

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
Chapter 14: Caching problem dbcook8 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 4 October 19th, 2008 10:46 AM
Problem : Sketcher in chapter 14 chang82 BOOK: Ivor Horton's Beginning Visual C++ 2005 1 September 8th, 2008 02:29 AM
Chapter 14 - use of CObject problem jabuck BOOK: Ivor Horton's Beginning Visual C++ 2005 0 February 15th, 2007 02:25 PM
Problem with code on Chapter 14 aargyri BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 3 June 6th, 2006 03:37 PM



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


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