Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Updating CursorAdapter w/Free Tables
Message
From
12/10/2006 02:39:13
 
 
To
11/10/2006 16:46:21
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01161323
Message ID:
01161388
Views:
26
>All,
>
>Our company is in the process of trying to migrate old legacy data over to SQL Server. My Idea was to try and use cursor adapters--a very wonderful invention. Because these tables are used in a plethora of different applications, I can't just DTS them into SQL Server. I want to create the cursor adapter to initially pull from old FoxPro DOS table structures. When we have converted all the applications, then switch the DataSource and DataSourceType to go to SQL. My problem revolves around trying to update one of these Free tables in a CA. It runs CursorFill just fine, takes the insertion of data w/o a problem, but my TableUpdate() returns a .F. I'm at a loss and was hoping I could get some assistance on this.
>
>Here's the code:
>
>
>PUBLIC cacs as CursorAdapter
>caCS = CREATEOBJECT('cursoradapter')
>SET MULTILOCKS ON
>
>WITH cacs
>  .Name = 'caCACS'
>  .Alias = 'vCACS'
>  .AllowInsert=.T.
>  .AllowUpdate=.T.
>  .BufferModeOverride= 5
>  .CursorSchema = ;
>    [CUSTSERID I,  FR C(6) DEFAULT '', ] + ;
>    [GRADE C(2) DEFAULT '', LOTCONTROL C(9) DEFAULT '', ] + ;
>    [MHEAT C(4) DEFAULT '', PHEATSFX C(2)   DEFAULT '', ] + ;
>    [PROD_HEAT C(6) DEFAULT '']
>  .DataSourceType = 'ODBC'
>  .DATASOURCE= SQLSTRINGCONNECT([DSN=Visual FoxPro Tables;UID=;PWD=;] + ;
>    [SourceDB=G:\SOFTWARE\SERIAL\;SourceType=DBF;Exclusive=No;] + ;
>    [BackgroundFetch=Yes;Collate=Machine;])
>  .KeyFieldList = 'CustSerID'
>  .NoData = .T.
>  .Prepared = .F.
>  .SelectCmd = [select custserid, fr, grade, lotcontrol, mheat,]+ ;
>    [ prod_heat, pheatsfx from custser WHERE custserid = ?gnCustSerID]
>  .Tables = 'CustSer'
>  .UpdatableFieldList = [CUSTSERID, FR, LOTCONTROL, PROD_HEAT, ] + ;
>    [PHEATSFX, GRADE, MHEAT]
>  .UpdateNameList =[CUSTSERID custser.custserid, FR custser.fr, ] + ;
>    [LOTCONTROL custser.lotcontrol, PROD_HEAT custser.prod_heat, ] + ;
>    [PHEATSFX custser.pheatsfx, GRADE custser.grade, MHEAT custser.mheat ]
>  .UpdateType= 1
>  .UseCursorSchema = .T.
>  .SendUpdates = .T.
>  .WhereType = 3
>  ? .CursorFill(.T.,.T.)
>ENDWITH
>
>BROWSE LAST NOWAIT
>INSERT INTO vcacs (custserid, fr, lotcontrol, prod_heat, grade, mheat) ;
>	 VALUES (3779862, '11181', 'ND23734', 'LC2631', 'SG', '6271')
>
>? TABLEUPDATE(1)	
>
>
>TIA,

Always check the result of TableUpdate:
IF NOT TABLEUPDATE(1, .t., [vcacs])
   AERROR(laError)
   MessageBox(laError[1,2])
ENDIF
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform