473,320 Members | 1,600 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,320 software developers and data experts.

Error opening recordset - 'Too few parameters'

I have a problem on programming, i am not that good but i can read and implement some programs.

I just wanna ask help on this code

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/pang/view_station.asp, line 14
which is "myrec.Open sql"

i did all suggestion from the net but still i can't solve it.
Any help is higly appreciated.

thanks
Meynard

Expand|Select|Wrap|Line Numbers
  1. <% 
  2. Session("GB_DATABASE") = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("_db/links.mdb")  
  3. Set Conn = Server.CreateObject("ADODB.Connection")  
  4. Conn.Mode = 3
  5. Conn.Open Session("GB_DATABASE")
  6. %>
  7. <%
  8. Set myrec = Server.CreateObject ("ADODB.Recordset")
  9. Set myrec.ActiveConnection = conn
  10. Dim sql
  11. sql = "select * from station WHERE name =" & Request.QueryString("neym")
  12. myrec.CursorType = 3
  13. myrec.Open sql
  14. %>
Aug 1 '08 #1
2 1952
DrBunchman
979 Expert 512MB
Hi Meynard,

Welcome to Bytes! I hope you find the site useful. Please take the time to read the Posting Guidelines. Please also wrap any code you print in CODE tags using the # button at the top of the editor window as they make your posts much easier to read.

The problem is that you haven't specified the connection you are using to open your recordset. Try the following instead:
Expand|Select|Wrap|Line Numbers
  1. myrec.Open sql, conn
Hope this helps,

Dr B
Aug 1 '08 #2
Jerry Winston
145 Expert 100+


Expand|Select|Wrap|Line Numbers
  1. <% 
  2. Session("GB_DATABASE") = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("_db/links.mdb")  
  3. Set Conn = Server.CreateObject("ADODB.Connection")  
  4. Conn.Mode = 3
  5. Conn.Open Session("GB_DATABASE")
  6. %>
  7.  

looks like you're missing your connectionstring. Use your session variable GB_DATABASE as the connection string. try this:
Expand|Select|Wrap|Line Numbers
  1. <% 
  2. Session("GB_DATABASE") = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("_db/links.mdb")  
  3. Set Conn = Server.CreateObject("ADODB.Connection")  
  4. Conn.Mode = 3
  5. Conn.connectionstring Session("GB_DATABASE")
  6. Conn.Open 
  7. %>
  8.  
Aug 1 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Robert Mark Bram | last post by:
Hi All! I have the following two methods in an asp/jscript page - my problem is that without the update statement there is no error, but with the update statement I get the following error: ...
6
by: wk6pack | last post by:
Hi, I have a question about my coding practise. I have a class method to return a value from a database. I open the connection do my search and dispose the reader. Open the reader with a new...
4
by: Bryan Tang | last post by:
I built an ASP to search the content in index server. It is ok if search in English. Whenever I search in Chinese, I will got the following error message, CreateRecordset ?u?~ '80004005' ...
2
by: Reggie | last post by:
Hi and TIA! I have a query that uses 2 values from my form as criteria for 2 fields in the query. I can select the options and open the query. I can base a form on the query and launch it from...
7
by: Dee | last post by:
Running an AfterUpdate event procedure, I get the following error: "Too few parameters. Expected 1." My code is as follows: Private Sub DealerID_AfterUpdate() Dim db As DAO.Database
2
by: Steve Jorgensen | last post by:
When writing VB or VBA code that works with databases or other external libraries that cannot be trusted to automatically do the right thing when references to their objects are arbitrarily...
4
by: breadhead | last post by:
Good morning, all. I am creating an Access 2002 application to run on XP clients and I'm struggling with the task of testing whether a single-field record exists before allowing the user to add it...
15
by: Dave | last post by:
I am getting the error above intermittantly with an ASP 3.0 page using an MS Access 2003 database. I have searched Google extensively and found the following possible causes for this error: A...
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.