|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Too few parameters. Expected 1.
Hey all. I'm trying to execute the following SQL statement in VB 6.0.
db.Execute ( "SELECT Year(WO!COMPLETIONDATE)*100+Month(WO!COMPLETIONDATE) AS [Month], Count(WO.WONUM) AS CountOfWONUM INTO Completed2 From WO Where (((WO.REQUESTDATE) < MyDate)) GROUP BY Year(WO!COMPLETIONDATE) * 100 + Month(WO!COMPLETIONDATE) ORDER BY Year(WO!COMPLETIONDATE)*100 + Month(WO!COMPLETIONDATE);" ) The field names are all correct and everything, but I'm getting a "Too few parameters. Expected 1" error. I have no idea why. I put this in directly from Access, and I think I have to change it, but I'm not sure to what. Can any of you help? Thanks. |
|
#2
|
|||
|
|||
|
Typically, if I have a problem with an SQL statement, I display it in a label after it is built in my program. Then I cut and paste the output into Access to test if the query runs there. Within Access I make the needed changes to get the query running... after which I format my build statements in VB to match the syntax of the Access query.
|
|
#3
|
|||
|
|||
|
Problem
Looks like a Maximo database to me. Depending on your DB backend I would think the Year() or month() might be an issue. I would make sure the query runs in your sqltalk/sqlplus/whatever command line query tool you have.
|
|
#4
|
|||
|
|||
|
Hi,acknight!
I think it is incorrect in the end of your sql statement. It maybe: db.Execute ( "SELECT ....COMPLETIONDATE)" ) take out the ":"... |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Too few parameters. Expected 1. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|