Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WHERE clause not working on ADO CursorAdapter.SelectCmd
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
WHERE clause not working on ADO CursorAdapter.SelectCmd
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows 2000 SP4
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01062244
Message ID:
01062244
Views:
88
Hi. We're porting a free-table native VFP app to SQL and we're trying to figure out our transition strategy. I'm trying out the cursoradapter via ADO and am having problems with a parameterized select.

I've seen the mctweedle example and I can't get even that style of query to work. However, I can pull the whole table down into the cursor. How can I get this to work?

We specify the key entity I need using three fields (long story, legacy design) called clid char(4), usrid char(4), and acct char(12). The CursorFill only returns a record set when I have no WHERE clause at all. I tried a cursorfill after each of the selectcmds below and only the last one worked. ARRGGHH!

Here's my test code:
loConnDataSource = createobject('ADODB.Connection')
loConnDataSource.ConnectionString = [Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;] + ;
	[Initial Catalog=JPtest;Data Source=localhost;]
loConnDataSource.Open()
oadapter=CREATEOBJECT("cursoradapter")
oadapter.DataSourceType ="ADO"
oadapter.Tables = [ror]
oadapter.Alias = "JPROR"
oadapter.DataSource = createobject('ADODB.RecordSet')
oadapter.DataSource.LockType         = 3
oadapter.DataSource.ActiveConnection = loConnDataSource
cCua = "20199019TEST        "
cc = "2019"
cu = "9019"
ca = "TEST        "
oadapter.SelectCmd = [select * from ror WHERE clid+usrid+acct = ?cCua]
oadapter.SelectCmd = [select * from ror WHERE clid+usrid+acct = cCua]
oadapter.SelectCmd = [select * from ror WHERE clid=?cc and usrid=?cu and acct =?ca]
oadapter.SelectCmd = [select * from ror WHERE clid= cc and usrid= cu and acct = ca]
oadapter.SelectCmd = [select * from ror WHERE clid+usrid+acct LIKE cCua]
oadapter.SelectCmd = [select * from ror WHERE clid LIKE cc and usrid LIKE cu and acct LIKE ca]
oadapter.SelectCmd = [select * from ror WHERE clid LIKE cc]
oadapter.SelectCmd = [select * from ror WHERE clid LIKE ?cc]
oadapter.SelectCmd = [select * from ror WHERE .T.]
oadapter.SelectCmd = [select * from ror ]
---
Thanks, JP
Next
Reply
Map
View

Click here to load this message in the networking platform