Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP error

Status
Not open for further replies.

finnoscar

Technical User
Aug 17, 2002
55
GB
Whenever I try to run the following JScript :


<% @ Language = jscript %>
<%





function JScriptDatabaseRead() {
/*
declare variables

*/
var c, r, strOut = &quot;&quot;;
var sql = &quot;SELECT BreedName FROM Breeds WHERE Size = 'L' ORDER BY Size;&quot;;
var cnstr = &quot;&quot;;

var vbCrLf = String.fromCharCode( 13, 10 );


cnstr+= &quot;Provider=Microsoft.Jet.OLEDB.4.0;&quot;;

cnstr+= &quot;Data Source=&quot; + Server.Mappath(&quot;./DogBreeds1.mdb&quot;);


c = new ActiveXObject(&quot;ADODB.Connection&quot;);

c.Open(cnstr);

//c.Open( Application(&quot;dbConn&quot;), Application(&quot;dbUsr&quot;), Application(&quot;dbPass&quot;) );

r = c.Execute(sql);


while (!r.BOF & !r.EOF){
strOut+= r(0) + &quot;<BR>&quot; + vbCrLf;
r.MoveNext();
} // end while


/*
Close and free variables.
*/
r.Close();
c.Close();

/*
The return Statement exits the function and returns a value.

*/
return(strOut);
}
%>


<html>
<head>
<title>Dog Breed Selector</title>
</head>
<body >


<h3>Dog Breed Selector</h3>

From your responses to the questionnaire I believe that suitable possible breeds
for you would be:
<BR>
<BR>


<%
// call function and write the results to the browser.
Response.Write ( JScriptDatabaseRead() );
%>


</body>
</html>
I get the follwing message;
Error Type:
(0x80004005)
Unspecified error
/BreedSelector.asp, line 31


Could anyone tell me where I'm going wrong,please?
 
which one is line 31 ? I hope that tomorow I'll still be alive and kicking.
 
Line 31 is the one that says:

r=c.Execute(sql);
 
the error is coming from your sql statement. try this

var sql = &quot;SELECT BreedName FROM Breeds WHERE Size = 'L' ORDER BY Size&quot;
You cannot mandate productivity, you must provide the tools to let people become their best.
-Steve Jobs
admin@onpntwebdesigns.com
 
forgot this is js,
var sql = &quot;SELECT BreedName FROM Breeds WHERE Size = 'L' ORDER BY Size&quot;;
You cannot mandate productivity, you must provide the tools to let people become their best.
-Steve Jobs
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top