Whenever I try to run the following JScript :
<% @ Language = jscript %>
<%
function JScriptDatabaseRead() {
/*
declare variables
*/
var c, r, strOut = "";
var sql = "SELECT BreedName FROM Breeds WHERE Size = 'L' ORDER BY Size;";
var cnstr = "";
var vbCrLf = String.fromCharCode( 13, 10 );
cnstr+= "Provider=Microsoft.Jet.OLEDB.4.0;";
cnstr+= "Data Source=" + Server.Mappath("./DogBreeds1.mdb"
;
c = new ActiveXObject("ADODB.Connection"
;
c.Open(cnstr);
//c.Open( Application("dbConn"
, Application("dbUsr"
, Application("dbPass"
);
r = c.Execute(sql);
while (!r.BOF & !r.EOF){
strOut+= r(0) + "<BR>" + 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?
<% @ Language = jscript %>
<%
function JScriptDatabaseRead() {
/*
declare variables
*/
var c, r, strOut = "";
var sql = "SELECT BreedName FROM Breeds WHERE Size = 'L' ORDER BY Size;";
var cnstr = "";
var vbCrLf = String.fromCharCode( 13, 10 );
cnstr+= "Provider=Microsoft.Jet.OLEDB.4.0;";
cnstr+= "Data Source=" + Server.Mappath("./DogBreeds1.mdb"
c = new ActiveXObject("ADODB.Connection"
c.Open(cnstr);
//c.Open( Application("dbConn"
r = c.Execute(sql);
while (!r.BOF & !r.EOF){
strOut+= r(0) + "<BR>" + 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?