Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 26th, 2004, 03:23 PM
matrec matrec is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 25 matrec User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 55 sec
Reputation Power: 0
Too few parameters. Expected 1

I have no experience , but I wrote this, in order to count
the records from qryWLFormToOwner when notNo = " & Me!cboSelectFakellos

Private Sub cboSelectIdiotisTo_AfterUpdate()
Dim sql As String
Dim dbs As Database
Dim rs As Recordset
Dim cnt As String
Set dbs = CurrentDb
sql = "Select IDCard From qryWLFormToOwner Where notNo = " & Me!cboSelectFakellos
Set rs = dbs.OpenRecordset(sql, dbOpenSnapshot)
If Not rs.EOF Then
rs.MoveLast
End If
cnt = rs.RecordCount
Me.txtCount = cnt 'txtCount is a textbox in my Form
Set dbs = Nothing
Set rs = Nothing
End Sub

The Private Sum won't run, the message "Too few parameters. Expected 1"
appears and when I press Debug the following line is shown yellow:
Set rs = dbs.OpenRecordset(sql, dbOpenSnapshot)
Is there an obvious mistake ?

Reply With Quote
  #2  
Old October 26th, 2004, 07:14 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 21 h 32 m 23 sec
Reputation Power: 180
Usually that error means you have mis-spelled a column name in your sql.
__________________
======
Doug G
======
I didn't attend the funeral, but I sent a nice letter saying I approved of it. --Mark Twain

Reply With Quote
  #3  
Old October 27th, 2004, 12:02 AM
matrec matrec is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 25 matrec User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 55 sec
Reputation Power: 0
Thanks, I will check.

Reply With Quote
  #4  
Old October 27th, 2004, 12:36 AM
Leslie's Avatar
Leslie Leslie is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Honolulu
Posts: 184 Leslie User rank is Corporal (100 - 500 Reputation Level)Leslie User rank is Corporal (100 - 500 Reputation Level)Leslie User rank is Corporal (100 - 500 Reputation Level)Leslie User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 20 h 29 m 2 sec
Reputation Power: 8
There are other ways this error can trigger ...

Arguments for a connection string can vary depending upon what kind of connection it is. In the statement below, these are your arguements:
Set rs = dbs.OpenRecordset(sql, dbOpenSnapshot)
And the args and syntax you use can vary depending upon what type of data access you are using.

Here is syntax for one of many ways to connect using "Microsoft ActiveX Data Objects"
Set ObjConn = Server.CreateObject ("ADODB.Connection")
Set rs1 = CreateObject("ADODB.Recordset")
Set rs1 = mydb.OpenRecordset("SELECT * FROM myTable")

Here is one using "Microsoft DAO 3.6"
Dim db as DAO.Database, rs as DAO.recordset
sql="SELECT * FROM myTable"
Set rs = db.OpenRecordset(sql)

Either way, if you are using VB you have to have the correct library selected in your project (Tools ... References) to go with the syntax you are using. If you have DAO 3.6 included and you use "Dim rs as recordset" You might be able to get away with it sometimes but sooner or later the chances are it will fail on the OpenRecordset method of the object and that failure can manifest itself as "too few paramaters, expected 1" since it's the "OpenRecordset" method that is expecting "the parameters". This can even pop up on code that used to work but no longer does on account of simply including another library in your project that ALSO uses the term "recordset" Now VB doesn't know which one you want unless you specify.

Hope that helps!

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > Too few parameters. Expected 1


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway