>Local lcFox2xPath, lcConnName >lcDBCName = "myFox2xLink" >lcFox2xPath = 'c:\fpd26\tutorial' >lcConnName = "myFox2xLinker" >Create Database (m.lcDBCName) >Create2xConn(m.lcFox2xPath,m.lcConnName) >myViewMaker('v_customer','cno',m.lcFox2xPath,'customer',m.lcConnName) > >Use v_customer >CursorSetProp("Buffering",5,'v_customer') >CursorSetProp("BatchUpdateCount",10,'v_customer') > >Insert Into v_customer (cno) Values ("TRAN1") >Insert Into v_customer (cno) Values ("TRAN2") >Insert Into v_customer (cno) Values ("TRAN3") >Insert Into v_customer (cno) Values ("TRAN4") > >If !Tableupdate(2,.T.,'v_customer') && should fail > Sqlrollback(CursorGetProp("ConnectHandle",'v_customer')) >Endif >Select * From (Addbs(m.lcFox2xPath)+'customer') >Use In 'customer' > >Select v_customer >Scatter Memvar Memo Blank >For ix = 5 To 9 > m.cno = "TR"+Padl(m.ix,2,'_') > Insert Into v_customer From Memvar >Endfor > >If Tableupdate(2,.T.,'v_customer') && shoudl succeed > Sqlcommit(CursorGetProp("ConnectHandle",'v_customer')) >Endif > >Select * From (Addbs(m.lcFox2xPath)+'customer') >Use In 'customer' > >Close Databases All >Erase (m.lcDBCName+'.*') > >Procedure Create2xConn(tcDataPath,tcConnName) > Local lcConStr > lcConnStr = 'Driver={Microsoft Visual FoxPro Driver};'+; > 'SourceDB='+Addbs(m.tcDataPath)+';SourceType=DBF;Exclusive=No' > > Execscript(Textmerge("CREATE CONNECTION '<<m.tcConnName>>' CONNSTRING '<<m.lcConnStr>>'")) > > DBSetProp(m.tcConnName, 'Connection', 'Asynchronous', .F.) > DBSetProp(m.tcConnName, 'Connection', 'BatchMode', .T.) > DBSetProp(m.tcConnName, 'Connection', 'ConnectTimeOut', 15) > DBSetProp(m.tcConnName, 'Connection', 'DispWarnings', .F.) > DBSetProp(m.tcConnName, 'Connection', 'IdleTimeOut', 0) > DBSetProp(m.tcConnName, 'Connection', 'QueryTimeOut', 0) > DBSetProp(m.tcConnName, 'Connection', 'Transactions', 2) > DBSetProp(m.tcConnName, 'Connection', 'Database', '') >Endproc > >Procedure myViewMaker > Lparameters tcViewName, tcKeyField, tcPath, tcTableName,tcConnectionName > > Execscript(Textmerge(; > "Create Sql View '<<m.tcViewName>>' "+; > " remote connect '<<m.tcConnectionName>>'"+; > " As"+; > " Select * From ('<<Addbs(m.tcPath) + m.tcTableName>>')")) > > DBSetProp(m.tcViewName, 'View', 'WhereType', 3) > DBSetProp(m.tcViewName, 'View', 'SendUpdates', .T.) > DBSetProp(m.tcViewName, 'View', 'Tables', m.tcTableName) > > Use (Addbs(m.tcPath) + m.tcTableName) In 0 Again Alias __getfields > Afields(aFieldList, '__getFields') > Use In '__getFields' > > For ix=1 To Alen(aFieldList,1) > DBSetProp(m.tcViewName+'.'+aFieldList[m.ix,1], 'Field', 'KeyField', ; > Upper(aFieldList[m.ix,1])==Upper(m.tcKeyField)) > DBSetProp(m.tcViewName+'.'+aFieldList[m.ix,1], 'Field', 'Updatable', .T.) > DBSetProp(m.tcViewName+'.'+aFieldList[m.ix,1], 'Field', 'UpdateName', ; > m.tcTableName+'.'+aFieldList[m.ix,1]) > DBSetProp(m.tcViewName+'.'+aFieldList[m.ix,1], 'Field', 'DataType', ; > TEXTMERGE( "<<aFieldList[m.ix,2]>>(<<aFieldList[m.ix,3]>>" )+; > IIF(aFieldList[m.ix,4] > 0, Textmerge(",<<aFieldList[m.ix,4]>>)"), ')' )) > Endfor > >Endproc >>Cetin