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
|