Too few parameters to RecordSet.Open?

R

Robert Mark Bram

Hi All!

My ASP page below receives the following error:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
/polyprint/test.asp, line 31

Line 31 is this line from below:
newsletterText.open (sql);

The sql statement works ok in Access and I have used the ConnectionString on
other pages, so it works too. I have also used Open() in this way on other
pages..

I am a loss to know what other parameters are expected!

Any advice would be welcome!

Rob
:)


<%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
<!--#include virtual="/adojavas.inc"-->
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
/*
This works ok!
SELECT * FROM newsletterText
WHERE pageName="1"
and language="English"
order by paragraph
*/
var sql ="SELECT * FROM newsletterText " +
"WHERE pageName=\"1\"" +
" and language=\"English\" " +
"order by paragraph";

Response.Write( sql + "<br>");

var polyprintConnection = Server.CreateObject ("ADODB.Connection");
polyprintConnection.ConnectionString="DSN=PolyprintNewsletter";
polyprintConnection.Open();

var newsletterText = Server.CreateObject ("ADODB.Recordset");
newsletterText.ActiveConnection = polyprintConnection;
newsletterText.CursorType = adOpenForwardOnly;
newsletterText.CursorLocation = adUseClient;
newsletterText.LockType = adLockReadOnly;
newsletterText.open (sql);
%>
</body>
</html>
 
M

Manohar Kamath [MVP]

Looks like you might have misspelt the field names in your SQL, or they do
not exist. Plus, the delimiter for a string is ' in SQL

var sql ="SELECT * FROM newsletterText " +
"WHERE pageName='1'" +
" and language='English' " +
"order by paragraph";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top