Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursor Adapter class : insertion - one to many
Message
From
14/01/2004 02:44:20
Janet Uy
Computer Craft Corporation
Quezon, Philippines
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Cursor Adapter class : insertion - one to many
Miscellaneous
Thread ID:
00866606
Message ID:
00866606
Views:
68
Hi everyone. I have one primary table link to a foreign table. This is a one to many relationship. SQL Server back end

Primary Table Foreign table
Sample : Field name : ctrlno ctrlno
Field type : integer integer
Identity : Yes No
Purpose : using cursor adapter how can i replace the foreign key (ctrlno) with the autogenerated value of the primary field name.
Problem : Using the following program, would itemdtls.ctrlno inherit the auto generated value of invoice.ctrlno? Both tables are not updated.

Program :
Define Class clsArinv as CursorAdapter

AllowUpdate = .T.
AllowDelete = .T.
AllowInsert = .T.
SendUpdates = .T.
DataSourceType = "ODBC"
selectcmd = [select invoice.ctrlno, itemdtls.itemid ; from invoice, itemdtls where invoice.ctrlno = ;
itemdtls.ctrlno and arinv.ctrlno = ?nctrlno]
CursorSchema = [ctrlno i(4), itemid c(20)]
Tables = "invoice, itemdtls"
UpdatableFieldList = "ctrlno,itemid"
UpdateNameList = "ctrlno invoice.ctrlno, itemid itemdtls.itemid"

Procedure Init
*-- Add a property at run-time that holds a Connection Handle.
This.AddProperty('Connection',SQLSTRINGCONNECT(pvConnString))

*-- The data source is our Connection Handle
This.DataSource = This.Connection
EndProc

ENDDEFINE

Thanks in advance.
Next
Reply
Map
View

Click here to load this message in the networking platform