Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdapter Inconsistency
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00877700
Message ID:
00878440
Views:
17
Hi Neil,

I doesn't look like CursorAdapter inconsistency. Take a look into CommandText from the error information:
CommandText: SELECT prd_prd_cd,prd_prd_nm,prd_mem_pr FROM ic_prd WHERE prd_mem_pr=1 ORDER BY prd_prd_nm WHERE prd_mem_pr = 1
It has WHERE clause mentioned twice. Somewhere in your code you are changing SelectCmd property to this incorrect value. Probably it happens in BeforeCursorFill event handler, it appends WHERE to the SelectCmd property rather than to the input/output parameter cSelectCmd.

Thanks,
Aleksey.

>Hi Aleksey,
>
>I found the problem and it was a silly hidden SelectCmdFilter that had !DELETED() set as the default on these two classes. This caused an invalid WHERE clause to be generated against SQL server. Since my last post I have been working on another inconsistancy between FoxPro and SQL CursorAdapters.
>
>The following code is run to open up the inventory products table and retrieve only those products that are membership pass products (prd_mem_pr=1).
>
>goConnectString = [Provider=] + lcProvider + [;] + ;
> [Integrated Security=SSPI] + [;] + ;
> [Persist Security Info=False] + [;] +;
> [Initial Catalog=] + 'IC' + [;] + ;
> [Data Source=] + lcDataSrce + [;]
>
>DIMENSION .ado_recordset[1,2]
>
>.ado_recordset[1,1]='ic_prd'
>.ado_recordset[1,2]=CREATEOBJECT('baseCursorAdapter')
>.ado_recordset[1,2].CursorSchema = 'prd_prd_cd C(20),prd_prd_nm C(40),prd_mem_pr L'
>.ado_recordset[1,2].cSelectCmdOrderBy = 'prd_prd_nm'
>.ado_recordset[1,2].SelectCmd = 'SELECT prd_prd_cd,prd_prd_nm,prd_mem_pr FROM ic_prd'
>.ado_recordset[1,2].cSelectCmdFilter = 'prd_mem_pr = 1'
>.ado_recordset[1,2].Alias = 'ic_prd'
>.ado_recordset[1,2].Name = 'ic_prd'
>.ado_recordset[1,2].DataSourceType = 'ADO'
>.ado_recordset[1,2].lUseCursorSchema = .T.
>.ado_recordset[1,2].UpdatableFieldList = 'prd_prd_cd,prd_prd_nm,prd_mem_pr'
>.ado_recordset[1,2].UpdateNameList = 'prd_prd_cd ic_prd.prd_prd_cd,prd_prd_nm ic_prd.prd_prd_nm,prd_mem_pr ic_prd.prd_mem_pr'
>.ado_recordset[1,2].KeyFieldList = 'prd_prd_cd'
>.ado_recordset[1,2].Tables = 'ic_prd'
>.ado_recordset[1,2].GetSQLData('ic_prd')
>
>
>PROCEDURE GetSQLData(tcTable AS String)
>WITH This
> .ResetError()
> .lFilled = .CursorFill(.lUseCursorSchema, .F., -1, .oado_command)
>ENDWITH
>
>.lFilled returns a .F. and after I put some logic in to trap the error and save it to a memo field in an error table, the following error is recorded:
>
>Error Num: 1435
>Error Des: Microsoft OLE DB Provider for SQL Server : Incorrect syntax near the keyword 'WHERE'.
>Table: ic_prd
>DataSource: SELECT prd_prd_cd,prd_prd_nm,prd_mem_pr FROM ic_prd WHERE prd_mem_pr=1 ORDER BY prd_prd_nm WHERE prd_mem_pr = 1
>
>CommandText: SELECT prd_prd_cd,prd_prd_nm,prd_mem_pr FROM ic_prd WHERE prd_mem_pr=1 ORDER BY prd_prd_nm WHERE prd_mem_pr = 1
>
>Connect Str: Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=IC;Data Source=MARATHON_NT;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=NEILS;Use Encryption for Data=False;Tag with column collation when possible=False
>
>Default DB: IC
>
>Provider: SQLOLEDB.1
>
>SelectCmd: SELECT prd_prd_cd,prd_prd_nm,prd_mem_pr FROM ic_prd WHERE prd_mem_pr=1
>
>Any help in this would be greatly appreciated.
>
>Thanks,
>
>Neil
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform