Hi,
I'm trying to understand the usage of cursor adapters in VFP9sp2 and am having some issues...
I have the adapter created and attached to a form with an edit box bound to one of its fields... It is populating as expected.
Next I modified the data in the editbox and cannot get it to update the actual sql table.
Here is the setup properties:
Tag = "Driver={SQL Server};Server=DAS; Integrated Security=SSPI; Database=DEEDROOM;"
Top = 20
Left = 10
Height = 90
Width = 91
SelectCmd = select Page.county_pagekey, Page_Type, BOOK_NUM, Page_Prefix, Page_Num, SubPage_Num, Page_Date, IMAGE_PATH, ocr_text1, ocr_text2, Page.identity_id from Page where left(Page.county_pagekey,5)=?gcCounty
UpdateCmd = update Page set Page.ocr_text2 = crsPage.ocr_text2 where Page.identity_id = crsPage.identity_id
AllowUpdate = .T.
CursorSchema = COUNTY_PAGEKEY C(14), PAGE_TYPE C(40), BOOK_NUM C(24), PAGE_PREFIX C(24), PAGE_NUM C(12), SUBPAGE_NUM C(4), PAGE_DATE C(27), IMAGE_PATH C(146), OCR_TEXT1 M, OCR_TEXT2 M, IDENTITY_ID I
Alias = "crsPage"
DataSourceType = "ODBC"
Flags = 0
FetchAsNeeded = .F.
FetchSize = 10
MaxRecords = 15
WhereType = 2
KeyFieldList = IDENTITY_ID
Tables = Page
UpdatableFieldList = OCR_TEXT2
UpdateNameList = OCR_TEXT2 Page.ocr_text2, IDENTITY_ID Page.IDENTITY_ID
Name = "caPage"
The docs says that I need to have an update command which I do.
1. Do I still need to issue a TableUpdate(1, .T., 'crsPage') even though I have the editbox control bound to crsPage?
2. Why is the TableUpdate command operating on the VFP cursor named "crsPage" and not the underlying SQL table which is "Page"?
I'm getting errors like;
Connectivity error: [Microsoft][ODBC SQL Server Driver][SQL Server] The multi-part identifier "crsPage.identity_id" cound not be bound. This occurs when I move off the changed record, at which my choices are revert.
Batch update is set to "1".
I've read Jordanovia's excellent CursorAdapter article and reviewed her examples that she presented at SouthWest 2011, and I'm using it as a guide, but still falling short....
Any suggestions?
Thanks, Stanley
I'm trying to understand the usage of cursor adapters in VFP9sp2 and am having some issues...
I have the adapter created and attached to a form with an edit box bound to one of its fields... It is populating as expected.
Next I modified the data in the editbox and cannot get it to update the actual sql table.
Here is the setup properties:
Tag = "Driver={SQL Server};Server=DAS; Integrated Security=SSPI; Database=DEEDROOM;"
Top = 20
Left = 10
Height = 90
Width = 91
SelectCmd = select Page.county_pagekey, Page_Type, BOOK_NUM, Page_Prefix, Page_Num, SubPage_Num, Page_Date, IMAGE_PATH, ocr_text1, ocr_text2, Page.identity_id from Page where left(Page.county_pagekey,5)=?gcCounty
UpdateCmd = update Page set Page.ocr_text2 = crsPage.ocr_text2 where Page.identity_id = crsPage.identity_id
AllowUpdate = .T.
CursorSchema = COUNTY_PAGEKEY C(14), PAGE_TYPE C(40), BOOK_NUM C(24), PAGE_PREFIX C(24), PAGE_NUM C(12), SUBPAGE_NUM C(4), PAGE_DATE C(27), IMAGE_PATH C(146), OCR_TEXT1 M, OCR_TEXT2 M, IDENTITY_ID I
Alias = "crsPage"
DataSourceType = "ODBC"
Flags = 0
FetchAsNeeded = .F.
FetchSize = 10
MaxRecords = 15
WhereType = 2
KeyFieldList = IDENTITY_ID
Tables = Page
UpdatableFieldList = OCR_TEXT2
UpdateNameList = OCR_TEXT2 Page.ocr_text2, IDENTITY_ID Page.IDENTITY_ID
Name = "caPage"
The docs says that I need to have an update command which I do.
1. Do I still need to issue a TableUpdate(1, .T., 'crsPage') even though I have the editbox control bound to crsPage?
2. Why is the TableUpdate command operating on the VFP cursor named "crsPage" and not the underlying SQL table which is "Page"?
I'm getting errors like;
Connectivity error: [Microsoft][ODBC SQL Server Driver][SQL Server] The multi-part identifier "crsPage.identity_id" cound not be bound. This occurs when I move off the changed record, at which my choices are revert.
Batch update is set to "1".
I've read Jordanovia's excellent CursorAdapter article and reviewed her examples that she presented at SouthWest 2011, and I'm using it as a guide, but still falling short....
Any suggestions?
Thanks, Stanley