Clive Richmond
24-Feb-2017, 05:45 AM
I am still evaluating the possibility of setting this property to false and pleased to see it is no longer a design time only property.
Some of our Open As usage can be changed to using a connection id string but there are several other places where this is more difficult. Therefore, I am temporarily setting pbLoginOnOpen to true and resetting it once the task has been completed.
However, I noticed if I then open another table using the same Open As syntax I don’t get a “Can’t open table. Not logged into ...” My question is this behaviour expected and why, or should it fail?
// Create the open as string format which should resemble something like this:
// "{driver}:dbo#{table}@{connection string}|options|intfile={table.int}"
// "MSSQLDRV:dbo#customer@SERVER=.\SQLEXPRESS;DATABASE =Order Entry Flx2SQL;trusted_connection=yes|options|intfile=C:\ DataFlex 19.0 Examples\Order Entry\Data\customer.int"
Move "customer" To sTable
Get psDataPath Of (phoWorkspace(ghoApplication)) To sDataPath
If (Right(sDataPath, 1) <> '\') Move (sDataPath+'\') To sDataPath
Move (sDataPath+sTable+".int") To sIntFile
Move (SFormat("%1:dbo#%2@%3|options|intfile=%4", ltConnectionId.sDriver, sTable, ltConnectionId.sConnectionString, sIntFile)) To sTableConnStr
Move 0 To hSQLTable
Get_Attribute DF_FILE_NEXT_EMPTY Of hSQLTable To hSQLTable
Get pbLoginOnOpen Of ghoConnection To bOpen // reports false
Set pbLoginOnOpen Of ghoConnection To True
Open sTableConnStr As hSQLTable
Move WindowIndex To WindowIndex
Close hSQLTable
Set pbLoginOnOpen Of ghoConnection To bOpen
Get pbLoginOnOpen Of ghoConnection To bOpen // reports false
// Should this open the table or should it fail?
Get_Attribute DF_FILE_NEXT_EMPTY Of hSQLTable To hSQLTable
Move (Replaces("customer", sTableConnStr, "vendor")) To sTableConnStr
Open sTableConnStr As hSQLTable
Move WindowIndex To WindowIndex
Close hSQLTable
Some of our Open As usage can be changed to using a connection id string but there are several other places where this is more difficult. Therefore, I am temporarily setting pbLoginOnOpen to true and resetting it once the task has been completed.
However, I noticed if I then open another table using the same Open As syntax I don’t get a “Can’t open table. Not logged into ...” My question is this behaviour expected and why, or should it fail?
// Create the open as string format which should resemble something like this:
// "{driver}:dbo#{table}@{connection string}|options|intfile={table.int}"
// "MSSQLDRV:dbo#customer@SERVER=.\SQLEXPRESS;DATABASE =Order Entry Flx2SQL;trusted_connection=yes|options|intfile=C:\ DataFlex 19.0 Examples\Order Entry\Data\customer.int"
Move "customer" To sTable
Get psDataPath Of (phoWorkspace(ghoApplication)) To sDataPath
If (Right(sDataPath, 1) <> '\') Move (sDataPath+'\') To sDataPath
Move (sDataPath+sTable+".int") To sIntFile
Move (SFormat("%1:dbo#%2@%3|options|intfile=%4", ltConnectionId.sDriver, sTable, ltConnectionId.sConnectionString, sIntFile)) To sTableConnStr
Move 0 To hSQLTable
Get_Attribute DF_FILE_NEXT_EMPTY Of hSQLTable To hSQLTable
Get pbLoginOnOpen Of ghoConnection To bOpen // reports false
Set pbLoginOnOpen Of ghoConnection To True
Open sTableConnStr As hSQLTable
Move WindowIndex To WindowIndex
Close hSQLTable
Set pbLoginOnOpen Of ghoConnection To bOpen
Get pbLoginOnOpen Of ghoConnection To bOpen // reports false
// Should this open the table or should it fail?
Get_Attribute DF_FILE_NEXT_EMPTY Of hSQLTable To hSQLTable
Move (Replaces("customer", sTableConnStr, "vendor")) To sTableConnStr
Open sTableConnStr As hSQLTable
Move WindowIndex To WindowIndex
Close hSQLTable