Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdapter Updating
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01311736
Message ID:
01311835
Views:
23
Thanks to everyone for responding. I have reviewed all of your comments and some ideas I got on another source and have switched the CA to use OLEDB instead of ODBC and have gotten a little further along, but it still won't update the changes back to SQL Server. Here is the new code I am using;
**************************************************
*-- Class: BooksAndAuthors
*-- Program: BooksAndAuthors.prg
*
* CursorAdapter to provide access to the Microsoft
* SQL Server data for books and authors
*

DEFINE CLASS booksandauthors AS cursoradapter
	SelectCmd = [SELECT TI.Title_id, TI.Title, AU.au_Lname, ] + ;
					[AU.au_Fname, TI.PubDate, ] + ;
					[TI.Price AS Price FROM Titles TI ] + ;
					[JOIN TitleAuthor TA ON TI.Title_id = TA.Title_id ] + ;
					[JOIN Authors AU ON TA.au_id = AU.au_id ] + ;
					[ORDER BY 1,2,3]
	KeyFieldList = [title_id]
	UpdateNameList = "Title_id Titles.Title_id, Title Titles.Title"
	UpdatableFieldList = [Title]
	UpdateType = 1
	UseTransactions = .F.
	Alias = "BooksAndAuthors"
	DataSourceType = "ADO"
	CursorSchema = "Title_id C(6), Title C(120), Lname C(40), FName C(40), Pubdate T, Price Y"
	UseCursorSchema = .T.
	Name = "BooksAndAuthors"
	WhereType = 1
	
	FUNCTION Init
		WITH This
 			local loConnDataSource
 			loConnDataSource = createobject('ADODB.Connection')
 			***<DataSource>
 			loConnDataSource.ConnectionString = [provider=sqloledb;] + ;
 			                                    [Data Source=NYCPSJWBOOTH\VINCENT;] + ;
 			                                    [Initial Catalog=pubs;] + ;
 			                                    [User Id=emeduser;] + ;
 			                                    [Password=emedpwd;]
 			***</DataSource>
 			loConnDataSource.Open()
 			.DataSource = createobject('ADODB.RecordSet')
 			.DataSource.CursorLocation   = 3  && adUseClient
 			.DataSource.LockType         = 3  && adLockOptimistic
 			.DataSource.ActiveConnection = loConnDataSource
 			*** End of Select connection code: DO NOT REMOVE
		ENDWITH
	ENDFUNC
	
ENDDEFINE
Now when I call CursorFill() and then browse I can edit the title field but when I go to move off that field I get an error message that says;

Microsoft Cursor Engine: Multiple-Step operation generated errors. Check each status value.

with the OK, Revert, and Cancel buttons. I have no idea what status values this dialog is talking about.
Previous
Reply
Map
View

Click here to load this message in the networking platform