Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Too few parameters to RecordSet.Open?

Reply
Thread Tools

Too few parameters to RecordSet.Open?

 
 
Robert Mark Bram
Guest
Posts: n/a
 
      10-18-2003
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>


 
Reply With Quote
 
 
 
 
Manohar Kamath [MVP]
Guest
Posts: n/a
 
      10-18-2003
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" <(E-Mail Removed)> wrote in message
news:3f908bb3$0$10617$(E-Mail Removed) 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>
>
>



 
Reply With Quote
 
 
 
 
Robert Mark Bram
Guest
Posts: n/a
 
      10-18-2003
Ah ha!
Thank you Manohar, I was using the wrong delimiter!

Rob



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Too few parameters. Expected 2 geletine Java 3 05-22-2006 05:46 PM
SQL Exception: Too few parameters..... Aaron B. Java 2 11-23-2004 12:59 PM
Too few parameters. Expected 1. - Problem with asp/access kbrad ASP General 8 09-29-2004 04:48 PM
ERROR! [ODBC Microsoft Access Driver] Too few parameters. Expected 2. Miranda ASP General 6 11-29-2003 01:37 PM
Not your typical "too few parameters..." error Trey Guy ASP General 5 07-07-2003 08:21 PM



Advertisments