Data Select
Quick Question as I am not all that familiar with Select Statements.
I currently have a Windows app created in vb.net 2005 that returns records from a database via a ClientID.
The dataset was created using the wizard and there WHERE clause is as follows:
WHERE CLID = ?
This will allow me to pass only 1 clid at a time, what I need to do is pass a list of ID's (maybe 1 or possably 12 at a time). How can I change it to allow that to happen?
Thanks
[497 byte] By [
Critter] at [2007-11-11 10:27:00]

# 1 Re: Data Select
The SQL to select a list looks like this:
SELECT col1, col2, ...coln
FROM TableName
WHERE ClientID IN (x, y, z)
Unfortunately, you cannot pass the IN clause directly as a parameter. Here are a couple of workarounds:
http://support.microsoft.com/kb/555266
http://lists.evolt.org/archive/Week-of-Mon-20020527/113546.html
# 2 Re: Data Select
Thanks for the reply Phil,
Unfortunatly the server has no stored procedures. To cleat things up (should of mentioned this in the 1st post) We are using a CACHE database and I connect to it via ODBC. I used the wizard to build the dataset and it fill command, the fill command is like this
Me.DataTable1TableAdapter.Fill(Me.DataSet1.DataTable1, ARACCLTIDToolStripTextBox.Text)
What I need to do is change the textbox to a listbox and allow multiple values to be selected, then pass those values to the fill command to get the info.
Here is the datatable query string
SELECT ARACCOUNT.ARACID, ARACCOUNT.ARACCLTID, ARACCOUNT.ARACCLACCT, ARACCOUNT.ARACLSTDTE, ARENTITY.ARENNAME, ARRELATIONSHIP.ARRELTYPID, ARACCOUNT.ARACCURBAL, ARRELATIONSHIP.ARRELSTATUSID, ARRELATIONSHIP.ARRELPHASE FROM SQLUser.ARACCOUNT, SQLUser.ARRELATIONSHIP, SQLUser.ARENTITY WHERE (ARACCOUNT.ARACRPRELID = ARRELATIONSHIP.ARRELID) AND (ARRELATIONSHIP.ARRELENID = ARENTITY.ARENID) AND (ARACCOUNT.ARACCLTID = ?) AND (ARRELATIONSHIP.ARRELTYPID = 'PRIM') AND (ARRELATIONSHIP.ARRELPHASE NOT LIKE 'INACTIVE')