473,804 Members | 3,509 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multi Parameter Query - problem sending more then one parameter

2 New Member
Hi,

I am trying to create an ASP file which will search Multiple Values in a Database. Everything is fine if there is one parameter but if there are more I receive an SQL error message:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Alt LIKE Pa_RaM000 OR WHERE Alt LIKE Pa_RaM001'.


Any help solving the problem would be appreciated (I am struggeling with it for almost 2 weeks and haven't managed to solve it).

the parameters come as a splited string (already splitted)

I am using the following code for parameter and query definition:
Expand|Select|Wrap|Line Numbers
  1. QString="SELECT PartNo, Alt, UNIT, QTY1 FROM Stock WHERE Alt LIKE ? "
  2.  
  3. for i=Lbound(Splitted) to Ubound(Splitted)
  4.    Recordset2__MMColParam=Splitted(i)
  5.    Recordset2_cmd.Prepared = true
  6.    set Param =  Recordset2_cmd.CreateParameter("param"+chr(i), 200, 1, 255, "%" + Recordset2__MMColParam + "%") ' adVarChar
  7.    Recordset2_cmd.Parameters.Append(Param)
  8.    if i>0 then 
  9.       QString = QString & "OR WHERE Alt LIKE ? "
  10.    end if
  11. next 
  12.  
  13. QString = QString & "ORDER BY Alt ASC" 
  14. Recordset2_cmd.CommandText=QString 
  15.  
Thanks,
Vesper Ventura
Jul 16 '07 #1
2 2121
jhardman
3,406 Recognized Expert Specialist
Vesper

Syntax should be "WHERE xxx LIKE 'Joe' OR xxx LIKE 'Fred' "...etc.
You should not say OR WHERE

Jared
Jul 16 '07 #2
Vesper
2 New Member
Vesper

Syntax should be "WHERE xxx LIKE 'Joe' OR xxx LIKE 'Fred' "...etc.
You should not say OR WHERE

Jared

Thanks, I will try that right away.

Vesper Ventura
Jul 18 '07 #3

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

Similar topics

0
1738
by: VictorCorey | last post by:
Is it possible to use a multi-parameter query in .NET Here's the method Public Function SearchCatalog(ByVal searchString As String, ByVal allWords As String) As OleDbDataReade ' Create the connection objec Dim connection As New OleDbConnection(connectionString Dim command As New OleDbComman ' We guard agains bogus values here - if we receive anythin
4
2814
by: MSD | last post by:
I am running a report that uses a query as its record source and opens a form collecting beginning and ending item numbers to feed to the query. This works, but now I'm trying to use the result of a multi-select list box on the form to feed multiple item numbers to the query. In other words - if you pick item #100,105,110 from the list box, the query should display information for those 3 items. If I type 'IN (100,105,110)' in the...
0
1412
by: deathyam | last post by:
Hi, I am writing an application in Excel 97 in which the users click a button and data is saved/read to and from an Access 97 database on the LAN. I am concerned about performance because there will be multiple users using it at the same time. Generally my technique for database reads is as follows: -I create parameter queries in the database. Doing so allows me to use a sort of 'function' paradigm. i.e. given x and y, query fn...
3
2579
by: Steven J. Reed | last post by:
I must be missing something, because this should be easy to do. After the user has selected several options on a page, I do a database query which returns a few records that I want to pass to another page via XML. How do I do this? I typically Response.Redirect around my app, including various parameters. Do I just include the XML as a parameter as in: Response.Redirect("page.aspx?" & ds.WriteXML)
4
3192
by: Andy_Khosravi | last post by:
I'm trying to build a search utility for users to find 'inquiries' in my database that involves several tables. This is normally easy to do with the query builder, but I have a unique situation involving a multi select listbox. Unfortunatly, my SQL skills are somewhat limited, so I'm not sure if there is an easy way around it. To simplify the explanation, I'll simplify the table/field setup to get at the meat of the question. I have a...
0
2557
by: abhishekjethwani | last post by:
How to write a query to access tree structure form multi table. I m having five tables from them first table give me a data which act as the parameter for query for the second table and the two tables will give me parameter for the third and so on. at present i m writing five query and sending parameter to each query but i want an efficient way for this. its a parent child type relation.
16
2441
by: parez | last post by:
I start a BackGroundWorker to populate a grid. It is started off in the ui layer The thread follows( cannot think of a better word) the path UI->Layer1->Layer2->Communication Layer and it blocks (the server is executing somthing where which takes time)
17
3145
by: trose178 | last post by:
Good day all, I am working on a multi-select list box for a standard question checklist database and I am running into a syntax error in the code that I cannot seem to correct. I will also note that I am using Allen Browne's multi-select list box for a report as a guide. I should also note that my access skills are not the best so I may need some explaining on certain things. First let me give some background on the database: I have a...
5
5308
by: Trevisc | last post by:
Happy Thursday Everyone, I am trying to create a parameter that is one long varchar but that will be used in a SQL statement IN function: //string queryString = GetCurrentTitles(); //Below is for Test string queryString = "45322,32222,33344,55555"; dataset catalogDS = new dataset();
0
9588
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10327
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10085
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6857
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.