w32crazydev Level: Guest

|
Re: Passing Parameters to Stored MSAccess Queries thru ADO Data-Envmnt Archived to Disk
hello i think i can help you..
the following command creates an input parameter on the conne object
conne.Parameters.Append conne.CreateParameter("myfield_id",_
adInteger, adParamInput)
in order to understand a full code see this
Dim toconne As Connection
Dim mycmd As Command
Dim myrs As Recordset
'Create the dynamic pointer
Set toconne=New Connection
Set mycmd=New Command
'open the db using the jet provider
toconne.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;" & _
"DATA SOURCE=filename.mdb"
toconne.Open
mycmd.CommandType=adCmdUnknown
mycmd.CommandText="[the description]"
'create your parameter like this
mycmd.Parameters.Append _
mycmd.CreateParameter("a_date",adDate, _
adParamInput)
mycmd.Parameters.Append _
mycmd.CreateParameter("b_date",adDate, adParamInput)
'Set your values like this
mycmd.Parameters("a_date").Value= "8/2/1983" 'do the same for b_date
'Make your command associate with an active connection
mycmd.ActiveConnection=toconne
'get your records
Set myrs=mycmd.Execute
Alexander Lykourgos, www16.brinkster.com/w32crazydev
|