473,378 Members | 1,382 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Too few parameters to RecordSet.Open?

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
2 6708
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
Ah ha!
Thank you Manohar, I was using the wrong delimiter!

Rob
:)
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Bruno Alexandre | last post by:
Hi guys, withou using SP, I want to be able to add a Parameter to the SQL Query and retrive the Recordset so I can use the Paging property under the recorset object.... how can I do this? I'm...
8
by: CSDunn | last post by:
Hello, I have a situation in which I need to address three SQL Server 2000 Stored Procedure parameters in the OnClick event of an Option Group. The Option Group lives on an Access 2000 ADP form. ...
3
by: Ryan Hubbard | last post by:
I would like to run a query from VBA. The query will be one with parameters. Is there a way to run the query and have Access prompt for the values like it does if I where to execute it through...
7
by: Zlatko Matić | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
20
by: Darryl Kerkeslager | last post by:
I use the following code to retrieve to recordsets into two local tables, from an mdb file over a WAN. Works fine, but I'm trying to tweak the speed, and I have some questions: 1. I tried both...
1
by: Mayhem05 | last post by:
I have an Access 2003 database that I need to write some VBA code for to populate a table. The table is based on a query I have built in Access queries. Right now I have 2 parameters that are...
5
by: dana1 | last post by:
Hello Experts! Does anyone know if there is a way to set the values of query parameters from VBA for a report's recordsource? (i.e., I want to set the values of the parameters and NOT have the...
5
by: billelev | last post by:
Hi There, I am trying to execute a query using openRecordset on a query called 'AccountValues'. The 'AccountValues' query relies on another query, 'Prices', which in turn relies on a form for two...
3
by: Kassimu | last post by:
Hi there, I have a table with thousands of record entries, usually the user searches this table through SearchForm resulting into some recordset. What I need to do on this recordset is to...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.