Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Shareconnection - remote views
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Shareconnection - remote views
Miscellaneous
Thread ID:
00850009
Message ID:
00850009
Views:
69
Hi,
how is it possible to share the connection of two (or more) remote views.
I was never a problem to do this, but since updating to VFP8 I have problems with it in application.

See the code with SQL-server Northwind database, the result of the code is, that 2 connections are user instead of 2, though the property "Shareconnection" is set to true on both views.

What could be my mistake ?

Thank you,
Andreas

CODE -------------------------

DisplayStatus([Creating database...])
CLOSE DATA ALL
CREATE DATABASE 'TEST.DBC'
DisplayStatus([Creating connection TEST...])
MakeConn_TEST()
DisplayStatus([Creating view RVEMPLOYEES...])
MakeView_RVEMPLOYEES()
DisplayStatus([Creating view RVCUSTOMERS...])
MakeView_RVCUSTOMERS()
DisplayStatus([Finished.])

USE rvcustomers AGAIN IN 0
USE rvemployees AGAIN IN 0

? "Connecthandle: rvcustomers = ",CURSORGETPROP("ConnectHandle","rvcustomers")
? "Connecthandle: rvemployees = ",CURSORGETPROP("ConnectHandle","rvemployees")

USE IN rvcustomers
USE IN rvemployees

FUNCTION MakeConn_TEST
***************** Connection Definitions TEST ***************

CREATE CONNECTION TEST ;
CONNSTRING "DRIVER=SQL Server;SERVER=(local);UID=sa;PWD=;DATABASE=NORTHWIND"
****
DBSetProp('TEST', 'Connection', 'Asynchronous', .F.)
DBSetProp('TEST', 'Connection', 'BatchMode', .T.)
DBSetProp('TEST', 'Connection', 'Comment', '')
DBSetProp('TEST', 'Connection', 'DispLogin', 1)
DBSetProp('TEST', 'Connection', 'ConnectTimeOut', 15)
DBSetProp('TEST', 'Connection', 'DispWarnings', .F.)
DBSetProp('TEST', 'Connection', 'IdleTimeOut', 0)
DBSetProp('TEST', 'Connection', 'QueryTimeOut', 0)
DBSetProp('TEST', 'Connection', 'Transactions', 1)
DBSetProp('TEST', 'Connection', 'Database', '')

ENDFUNC

FUNCTION MakeView_RVEMPLOYEES
***************** View setup for RVEMPLOYEES ***************

CREATE SQL VIEW "RVEMPLOYEES" ;
REMOTE CONNECT "Test" ;
AS SELECT Employees.EmployeeID, Employees.LastName FROM dbo.Employees Employees

DBSetProp('RVEMPLOYEES', 'View', 'UpdateType', 1)
DBSetProp('RVEMPLOYEES', 'View', 'WhereType', 4)
DBSetProp('RVEMPLOYEES', 'View', 'FetchMemo', .T.)
DBSetProp('RVEMPLOYEES', 'View', 'SendUpdates', .T.)
DBSetProp('RVEMPLOYEES', 'View', 'UseMemoSize', 255)
DBSetProp('RVEMPLOYEES', 'View', 'FetchSize', -1)
DBSetProp('RVEMPLOYEES', 'View', 'MaxRecords', -1)
DBSetProp('RVEMPLOYEES', 'View', 'Tables', 'dbo.Employees')
DBSetProp('RVEMPLOYEES', 'View', 'Prepared', .F.)
DBSetProp('RVEMPLOYEES', 'View', 'CompareMemo', .T.)
DBSetProp('RVEMPLOYEES', 'View', 'FetchAsNeeded', .T.)
DBSetProp('RVEMPLOYEES', 'View', 'Comment', "")
DBSetProp('RVEMPLOYEES', 'View', 'BatchUpdateCount', 1)
DBSetProp('RVEMPLOYEES', 'View', 'ShareConnection', .T.)

*!* Field Level Properties for RVEMPLOYEES
* Props for the RVEMPLOYEES.employeeid field.
DBSetProp('RVEMPLOYEES.employeeid', 'Field', 'KeyField', .T.)
DBSetProp('RVEMPLOYEES.employeeid', 'Field', 'Updatable', .F.)
DBSetProp('RVEMPLOYEES.employeeid', 'Field', 'UpdateName', 'dbo.Employees.EmployeeID')
DBSetProp('RVEMPLOYEES.employeeid', 'Field', 'DataType', "I")
* Props for the RVEMPLOYEES.lastname field.
DBSetProp('RVEMPLOYEES.lastname', 'Field', 'KeyField', .F.)
DBSetProp('RVEMPLOYEES.lastname', 'Field', 'Updatable', .T.)
DBSetProp('RVEMPLOYEES.lastname', 'Field', 'UpdateName', 'dbo.Employees.LastName')
DBSetProp('RVEMPLOYEES.lastname', 'Field', 'DataType', "C(20)")
ENDFUNC

FUNCTION MakeView_RVCUSTOMERS
***************** View setup for RVCUSTOMERS ***************

CREATE SQL VIEW "RVCUSTOMERS" ;
REMOTE CONNECT "Test" ;
AS SELECT Customers.CustomerID, Customers.CompanyName FROM dbo.Customers Customers

DBSetProp('RVCUSTOMERS', 'View', 'UpdateType', 1)
DBSetProp('RVCUSTOMERS', 'View', 'WhereType', 4)
DBSetProp('RVCUSTOMERS', 'View', 'FetchMemo', .T.)
DBSetProp('RVCUSTOMERS', 'View', 'SendUpdates', .T.)
DBSetProp('RVCUSTOMERS', 'View', 'UseMemoSize', 255)
DBSetProp('RVCUSTOMERS', 'View', 'FetchSize', -1)
DBSetProp('RVCUSTOMERS', 'View', 'MaxRecords', -1)
DBSetProp('RVCUSTOMERS', 'View', 'Tables', 'dbo.Customers')
DBSetProp('RVCUSTOMERS', 'View', 'Prepared', .F.)
DBSetProp('RVCUSTOMERS', 'View', 'CompareMemo', .T.)
DBSetProp('RVCUSTOMERS', 'View', 'FetchAsNeeded', .T.)
DBSetProp('RVCUSTOMERS', 'View', 'Comment', "")
DBSetProp('RVCUSTOMERS', 'View', 'BatchUpdateCount', 1)
DBSetProp('RVCUSTOMERS', 'View', 'ShareConnection', .T.)

*!* Field Level Properties for RVCUSTOMERS
* Props for the RVCUSTOMERS.customerid field.
DBSetProp('RVCUSTOMERS.customerid', 'Field', 'KeyField', .T.)
DBSetProp('RVCUSTOMERS.customerid', 'Field', 'Updatable', .F.)
DBSetProp('RVCUSTOMERS.customerid', 'Field', 'UpdateName', 'dbo.Customers.CustomerID')
DBSetProp('RVCUSTOMERS.customerid', 'Field', 'DataType', "C(5)")
* Props for the RVCUSTOMERS.companyname field.
DBSetProp('RVCUSTOMERS.companyname', 'Field', 'KeyField', .F.)
DBSetProp('RVCUSTOMERS.companyname', 'Field', 'Updatable', .T.)
DBSetProp('RVCUSTOMERS.companyname', 'Field', 'UpdateName', 'dbo.Customers.CompanyName')
DBSetProp('RVCUSTOMERS.companyname', 'Field', 'DataType', "C(40)")
ENDFUNC


FUNCTION DisplayStatus(lcMessage)
WAIT WINDOW NOWAIT lcMessage
ENDFUNC

CODE -------------------------
Next
Reply
Map
View

Click here to load this message in the networking platform