Wrox Programmer Forums
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 11th, 2004, 01:35 PM
Authorized User
Join Date: Sep 2003
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


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.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!

Old March 22nd, 2004, 12:59 PM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

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?



Imar Spaanjaars
Everyone is unique, except for me.

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

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.