Re: What to use for ADO parameter type and size
- From: "Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx>
- Date: Fri, 27 Jul 2007 10:39:58 -0400
RB Smissaert wrote:
Running a parameterized query that loops throughWhat doesn't look right about it (besides the fact that you did not tell ADO
a variant array holding integer values. These values may go up to
something like 123456789012345, so beyond
the Integer or Long datatype.
The code will be like this:
----------------------------------------------------------------
Dim cmdADO As ADODB.Command
Dim oParam As ADODB.Parameter
Set cmdADO = New ADODB.Command
Set oParam = New ADODB.Parameter
With cmdADO
.ActiveConnection = ADOConn
.CommandText = strSQL3 & "?"
.CommandType = adCmdText
End With
With oParam
.Type = adChar
.Size = 15
.Direction = adParamInput
End With
cmdADO.Parameters.Append oParam
For i = 0 To UBound(arr2)
cmdADO.Parameters(0).Value = arr2(i, 0) 'this is a variant
array
Set rs = cmdADO.Execute()
----------------------------------------------------------
How should I define the properties of oParam?
The coding as above works, but somehow doesn't look quite right.
Any suggestions/advice?
not to build a recordset)?
It could have been simpler: you did not have to use an explicit parameter
object:
Dim cmdADO As ADODB.Command
Set cmdADO = New ADODB.Command
With cmdADO
Set .ActiveConnection = ADOConn '"Set" should be used here
.CommandText = strSQL3 & "?"
.CommandType = adCmdText
.Execute ,Array(arr2(i, 0)), adExecuteNoRecords
End With
But really, there's nothing whrong with what you did.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
.
- Follow-Ups:
- Re: What to use for ADO parameter type and size
- From: RB Smissaert
- Re: What to use for ADO parameter type and size
- From: RB Smissaert
- Re: What to use for ADO parameter type and size
- References:
- What to use for ADO parameter type and size
- From: RB Smissaert
- What to use for ADO parameter type and size
- Prev by Date: Re: number field comes in as integer
- Next by Date: Re: Which ADO provider to use to connect to MS Access DB under Vista x64 ?
- Previous by thread: What to use for ADO parameter type and size
- Next by thread: Re: What to use for ADO parameter type and size
- Index(es):
Relevant Pages
|
|