Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLEDB Parameterised query
Message
 
 
To
25/09/2002 00:25:15
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00704088
Message ID:
00704663
Views:
27
It should work. Do you've SP1 installed?
BTW, there's also nice utility that allows to browse ADO recordset ADO Browse: Utility to browse ADO RS. File #9783.


>Hi All,
>
>Im trying to use the vfp ole db provider to query a table using ado parameters. Whats happening is that when I run a parameterised query it wont retrieve the record, but when the value is hard coded into the select statement it happily grabs the record. He is a sample:
>
>
>LOCAL loConn AS ADODB.Connection
>LOCAL loCommand AS ADODB.Command
>LOCAL loRecordSet AS ADODB.Recordset
>
>loConn = CREATEOBJECT("ADODB.Connection")
>
>loConn.ConnectionString = [Provider=VFPOLEDB.1;Data Source=D:\DEV\Temp\Data\data.dbc;Collating Sequence=MACHINE]
>
>loConn.Open()
>
>loCommand = CREATEOBJECT("ADODB.Command")
>loCommand.ActiveConnection = loConn
>
>loCommand.CommandText = [SELECT myTable.* FROM myTable WHERE RecID = ? or RecID = 1]
>loCommand.CommandType = 1
>loCommand.Parameters.Append( loCommand.CreateParameter("RecID", 3, 1, , 7))
>
>loRecordSet = loCommand.Execute()
>
>DO WHILE !loRecordSet.EOF
>	?loRecordSet.Fields('RecID').Value
>	loRecordSet.MoveNext()
>ENDDO
>
>
>This retrieves the record with the id of 1 but not the record with the id of 7.
>
>Can anyone show me what I might be doing wrong here?
>
>Thanks,
>
>Michael Henstock
>AWS
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform