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

ADO Command Object with Array Parameter

Has anyone had any success passing an adArray arg to a command object
parameter for an IN Clause?
As in "SELECT * FROM tmp1 WHERE MyID IN ?"

I successfully open the connection object, and I can append the param the
the parameters collection but I can not get the result I am looking for.

I am using VBScript

dim cmd
set cmd = createObject("ADODB.Command")

const adArray = xH2000
const adInteger = 5
const adParamInput = 1

dim a
a(0) = 4
a(1) = 5
a(2) = 6

cmd.parameters.Append cmd.CreateParameter(, adArray Or adInteger,
adParamInput, 8, a))

I have tried it a million different ways. It appends to the collection just
fine if I leave off the Array, but as soon as I try to set the params value
to an Array, I get a wrong type error. I checked the field in the table and
Access lists it's value as Double. I thought it should have been a Long
Data Type. I have tried other values for adInteger, like adDouble, and a
couple others. Still nothing. I looked on the net and did not see any
Access databases getting this to work properly. Maybe it is not supported.
Anyways the desired result is to place the array in to the SQL statement IN
clause. Please point me in the right direction if anything is obvious.
Thanks to all who reply.

Regards,
Chris

Nov 13 '05 #1
4 11139
This is a very common question and it's been answered a number of times...
check the archives. (google groups)

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Chris Kettenbach" <ch***@piasd.org> wrote in message
news:Y7********************@giganews.com...
Has anyone had any success passing an adArray arg to a command object
parameter for an IN Clause?
As in "SELECT * FROM tmp1 WHERE MyID IN ?"

I successfully open the connection object, and I can append the param the
the parameters collection but I can not get the result I am looking for.

I am using VBScript

dim cmd
set cmd = createObject("ADODB.Command")

const adArray = xH2000
const adInteger = 5
const adParamInput = 1

dim a
a(0) = 4
a(1) = 5
a(2) = 6

cmd.parameters.Append cmd.CreateParameter(, adArray Or adInteger,
adParamInput, 8, a))

I have tried it a million different ways. It appends to the collection
just
fine if I leave off the Array, but as soon as I try to set the params
value
to an Array, I get a wrong type error. I checked the field in the table
and
Access lists it's value as Double. I thought it should have been a Long
Data Type. I have tried other values for adInteger, like adDouble, and a
couple others. Still nothing. I looked on the net and did not see any
Access databases getting this to work properly. Maybe it is not
supported.
Anyways the desired result is to place the array in to the SQL statement
IN
clause. Please point me in the right direction if anything is obvious.
Thanks to all who reply.

Regards,
Chris

Nov 13 '05 #2
I looked in the groups and it looks like it is not possible. I wish you
would have said that instead of me going on a wild goose chase. But, thanks
for replying nonetheless.

Regards,
Chris

"William (Bill) Vaughn" <bi**************@nwlink.com> wrote in message
news:uw**************@TK2MSFTNGP15.phx.gbl...
This is a very common question and it's been answered a number of times...
check the archives. (google groups)

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights. __________________________________

"Chris Kettenbach" <ch***@piasd.org> wrote in message
news:Y7********************@giganews.com...
Has anyone had any success passing an adArray arg to a command object
parameter for an IN Clause?
As in "SELECT * FROM tmp1 WHERE MyID IN ?"

I successfully open the connection object, and I can append the param the the parameters collection but I can not get the result I am looking for.

I am using VBScript

dim cmd
set cmd = createObject("ADODB.Command")

const adArray = xH2000
const adInteger = 5
const adParamInput = 1

dim a
a(0) = 4
a(1) = 5
a(2) = 6

cmd.parameters.Append cmd.CreateParameter(, adArray Or adInteger,
adParamInput, 8, a))

I have tried it a million different ways. It appends to the collection
just
fine if I leave off the Array, but as soon as I try to set the params
value
to an Array, I get a wrong type error. I checked the field in the table
and
Access lists it's value as Double. I thought it should have been a Long
Data Type. I have tried other values for adInteger, like adDouble, and a couple others. Still nothing. I looked on the net and did not see any
Access databases getting this to work properly. Maybe it is not
supported.
Anyways the desired result is to place the array in to the SQL statement
IN
clause. Please point me in the right direction if anything is obvious.
Thanks to all who reply.

Regards,
Chris


Nov 13 '05 #3
It IS possible, but it's not easy. There are several options if you want to
take this approach.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

"Chris Kettenbach" <ch***@piasd.org> wrote in message
news:HB*******************@newssvr13.news.prodigy. com...
I looked in the groups and it looks like it is not possible. I wish you
would have said that instead of me going on a wild goose chase. But,
thanks
for replying nonetheless.

Regards,
Chris

"William (Bill) Vaughn" <bi**************@nwlink.com> wrote in message
news:uw**************@TK2MSFTNGP15.phx.gbl...
This is a very common question and it's been answered a number of
times...
check the archives. (google groups)

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no

rights.
__________________________________

"Chris Kettenbach" <ch***@piasd.org> wrote in message
news:Y7********************@giganews.com...
> Has anyone had any success passing an adArray arg to a command object
> parameter for an IN Clause?
> As in "SELECT * FROM tmp1 WHERE MyID IN ?"
>
> I successfully open the connection object, and I can append the param the > the parameters collection but I can not get the result I am looking
> for.
>
> I am using VBScript
>
> dim cmd
> set cmd = createObject("ADODB.Command")
>
> const adArray = xH2000
> const adInteger = 5
> const adParamInput = 1
>
> dim a
> a(0) = 4
> a(1) = 5
> a(2) = 6
>
> cmd.parameters.Append cmd.CreateParameter(, adArray Or adInteger,
> adParamInput, 8, a))
>
> I have tried it a million different ways. It appends to the collection
> just
> fine if I leave off the Array, but as soon as I try to set the params
> value
> to an Array, I get a wrong type error. I checked the field in the
> table
> and
> Access lists it's value as Double. I thought it should have been a
> Long
> Data Type. I have tried other values for adInteger, like adDouble, and a > couple others. Still nothing. I looked on the net and did not see any
> Access databases getting this to work properly. Maybe it is not
> supported.
> Anyways the desired result is to place the array in to the SQL
> statement
> IN
> clause. Please point me in the right direction if anything is obvious.
> Thanks to all who reply.
>
> Regards,
> Chris
>
>
>



Nov 13 '05 #4
ck
I am all ears Bill. Let's get an example if at all posible. Thanks in
advance for any help you may be able to provide.

"William (Bill) Vaughn" <bi**************@nwlink.com> wrote in message
news:uB**************@TK2MSFTNGP10.phx.gbl...
It IS possible, but it's not easy. There are several options if you want to take this approach.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights. __________________________________

"Chris Kettenbach" <ch***@piasd.org> wrote in message
news:HB*******************@newssvr13.news.prodigy. com...
I looked in the groups and it looks like it is not possible. I wish you
would have said that instead of me going on a wild goose chase. But,
thanks
for replying nonetheless.

Regards,
Chris

"William (Bill) Vaughn" <bi**************@nwlink.com> wrote in message
news:uw**************@TK2MSFTNGP15.phx.gbl...
This is a very common question and it's been answered a number of
times...
check the archives. (google groups)

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no

rights.
__________________________________

"Chris Kettenbach" <ch***@piasd.org> wrote in message
news:Y7********************@giganews.com...
> Has anyone had any success passing an adArray arg to a command object
> parameter for an IN Clause?
> As in "SELECT * FROM tmp1 WHERE MyID IN ?"
>
> I successfully open the connection object, and I can append the param

the
> the parameters collection but I can not get the result I am looking
> for.
>
> I am using VBScript
>
> dim cmd
> set cmd = createObject("ADODB.Command")
>
> const adArray = xH2000
> const adInteger = 5
> const adParamInput = 1
>
> dim a
> a(0) = 4
> a(1) = 5
> a(2) = 6
>
> cmd.parameters.Append cmd.CreateParameter(, adArray Or adInteger,
> adParamInput, 8, a))
>
> I have tried it a million different ways. It appends to the collection > just
> fine if I leave off the Array, but as soon as I try to set the params
> value
> to an Array, I get a wrong type error. I checked the field in the
> table
> and
> Access lists it's value as Double. I thought it should have been a
> Long
> Data Type. I have tried other values for adInteger, like adDouble, and
a
> couple others. Still nothing. I looked on the net and did not see

any > Access databases getting this to work properly. Maybe it is not
> supported.
> Anyways the desired result is to place the array in to the SQL
> statement
> IN
> clause. Please point me in the right direction if anything is obvious. > Thanks to all who reply.
>
> Regards,
> Chris
>
>
>



Nov 13 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Stefan Berglund | last post by:
I was looking for a general consensus as to whether the ActiveConnection property of the command object should be set to Nothing or whether it's sufficient to set the command object itself to...
4
by: Tom | last post by:
I want to open a recordset object on an .asp page. When I open the recordset I would like to use a stored procedure that expects a parameter to be passed for the stored procedure. I will then use...
7
by: What-a-Tool | last post by:
Have no problem getting my select queries to work using this method: strSQL = "SELECT tblUI.IPAdd FROM tblUI WHERE (tblUI.IPAdd =?)" arSPrm = Array(strRemHst) Set rst = cmd.Execute(,arSPrm)...
6
by: Arpan | last post by:
Microsoft advises not to pass parameters to the Command object in the Execute statement. Why? Thanks, Arpan
8
by: Dawn Minnis | last post by:
Hey guys If I have a program (see codeSnippet1) that I compile to be called test.o Then run it as test.o n n 2 3 4 I want the code to be able to strip out the two characters at the start...
0
by: Elliot M. Rodriguez | last post by:
I implemented a very small, basic data access layer for my web application. It works just fine, except for this one bug. One of my methods returns an abstracted dataset. To accomodate X number of...
8
by: djc | last post by:
I'm new to this and was wondering what the options are for interpreting the command line using a CLI program. Specifically methods for interpreting the parameters passed to the program on the...
4
by: George Shawn | last post by:
Hi, I am running into an extremely frustrating problem and after hours of troubleshooting have not made any progress. When I try to use the ADO Command object to update a table, I receive the...
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.