re: Concurrency and ADO.NET

| No Comments | No TrackBacks
I apologize for cross posting, this is just driving me crazy. I have been
beating myself up all day trying to find one good example of adArray as part
of a parameter. I went this route.

Sub Test1()
dim cn as new adodb.Connection
dim s$
s = "Provider=Microsoft.Jet.OleDb.4.0; Data Source = somefile.mdb;"
cn.Open s

dim cmd as new adodb.Command
with cmd
..ActiveConnection = cn
.CommandText = "SELECT CompanyName From [Names] WHERE NameType IN ?"
.CommandType = adCmdText
End With

Dim ax() As String
ReDim ax(1) As String
ax(0) = "Member"
ax(1) = "Exhibitor"

With prm1
.Type = 8392 'Errors right about here, I want the Array ( ax() in
this example ) to provide the parameter values for an SQL IN Clause
.Direction = adParamInput
.Size = 20
.Value = ax()
End With

cmd.Parameters.Append prm1

Dim rs As New ADODB.Recordset
rs.Open cmd, , adOpenStatic, adLockPessimistic

Debug.Print rs.RecordCount

rs.Close
Set rs = Nothing

cn.Close
Set cn = Nothing

End Sub

I have also tried cmd.Parameters.Append cmd.CreateParameter(, adArray or
adVarChar, adParamInput, 20, az()). I get an error saying wrong type of
arguments. I have tried just about possible DataType in the Array, Also
tried adVarray + adVarChar, still doen't worh right.

Any ideas? If you see anything obvious or any suggestions to try it a
different way, please let me know. Thank you to all whom reply.

Regards,

No TrackBacks

TrackBack URL: http://betav.com/blogadmin/mt-tb.cgi/1884

Leave a comment

Pages

Powered by Movable Type 4.21-en

About this Entry

This page contains a single entry by William Vaughn published on October 27, 2005 3:50 AM.

OT: vb:feeds was the previous entry in this blog.

re: Concurrency and ADO.NET is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.