By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,156 Members | 1,069 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,156 IT Pros & Developers. It's quick & easy.

Too few parameters to RecordSet.Open?

P: n/a
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=Polyprin tNewsletter";
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>
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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";

--
Manohar Kamath
Editor, .netBooks
www.dotnetbooks.com
--
Manohar Kamath
Editor, .netBooks
www.dotnetbooks.com
"Robert Mark Bram" <re********@removethis.optushome.com.au> wrote in message
news:3f***********************@news.optusnet.com.a u...
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=Polyprin tNewsletter";
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>

Jul 19 '05 #2

P: n/a
Ah ha!
Thank you Manohar, I was using the wrong delimiter!

Rob
:)
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.