query with parameter with ADO 
Author Message
 query with parameter with ADO

I need to run query from 'dBase IV' with parameters passed by textbox
I have to load a DataGrid, with ADO, with textbox as parameter.
I tried with database ACCESS and it runs:

    Private cnGriglia As ADODB.Connection
    Private rsGriglia As ADODB.Recordset
    Private cmd As ADODB.Command
    Private prm As ADODB.Parameter

    Set cnGriglia = New ADODB.Connection
    cnGriglia.CursorLocation = adUseClient
    Set rsGriglia = New ADODB.Recordset
    rsGriglia.CursorLocation = adUseClient
    cnGriglia.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.3.51;DataSource=TEST.mdb"
    cnGriglia.Open

    cmd.CommandText = "SELECT * From anagrafica Where
ragionesociale>=[inpMin] ORDER BY ragionesociale"
    cmd.CommandType = adCmdText
    Set prm = cmd.CreateParameter("inpMin", adVariant, adParamInput,
,PARAMETRO)
    cmd.Parameters.Append prm
    rsGriglia.Open cmd, , adOpenForwardOnly, adLockReadOnly

Using a DBF file I changed the ConnectionString:
    cnGriglia.ConnectionString =
"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=c:\path_DBF;Extended
Properties=dBase IV"

and at rsgriglia.Open    it occured  "PARAMETER NOT COMPLETE" ;
 if I write only  (select * from anagrafica) , it works.

Thank You!

Davide



Sun, 24 Oct 2004 23:13:04 GMT  
 query with parameter with ADO
Hi,

I think because you are using adVariant datatype. You need
to use particular datatype, which you have in your table

Val
Microsoft MVP

Quote:
>-----Original Message-----
>I need to run query from 'dBase IV' with parameters
passed by textbox
>I have to load a DataGrid, with ADO, with textbox as
parameter.
>I tried with database ACCESS and it runs:

>    Private cnGriglia As ADODB.Connection
>    Private rsGriglia As ADODB.Recordset
>    Private cmd As ADODB.Command
>    Private prm As ADODB.Parameter

>    Set cnGriglia = New ADODB.Connection
>    cnGriglia.CursorLocation = adUseClient
>    Set rsGriglia = New ADODB.Recordset
>    rsGriglia.CursorLocation = adUseClient
>    cnGriglia.ConnectionString =
>"Provider=Microsoft.Jet.OLEDB.3.51;DataSource=TEST.mdb"
>    cnGriglia.Open

>    cmd.CommandText = "SELECT * From anagrafica Where
>ragionesociale>=[inpMin] ORDER BY ragionesociale"
>    cmd.CommandType = adCmdText
>    Set prm = cmd.CreateParameter("inpMin", adVariant,
adParamInput,
>,PARAMETRO)
>    cmd.Parameters.Append prm
>    rsGriglia.Open cmd, , adOpenForwardOnly,
adLockReadOnly

>Using a DBF file I changed the ConnectionString:
>    cnGriglia.ConnectionString =
>"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=c:\path_DBF;E
xtended
>Properties=dBase IV"

>and at rsgriglia.Open    it occured  "PARAMETER NOT
COMPLETE" ;
> if I write only  (select * from anagrafica) , it works.

>Thank You!

>Davide

>.



Mon, 25 Oct 2004 20:02:43 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. query with parameter with ADO

2. query with parameter with ADO

3. query with parameters in ADO

4. calling parameter query from a parameter query

5. ADO Read-write parameter query recordsets

6. MS Access parameter queries using VID and ADO

7. Access parameter query with ADO

8. ADO & Access 2000 parameter queries

9. ADO 2.0 and Access Parameter Queries

10. ADO and Access Multiple Parameter Queries

11. Access query parameters within ADO

12. parameter queries and ADO and using the Update method

 

 
Powered by phpBB® Forum Software