You only need to set two transaction pairs.
The following example shows how to connect the SQL Server and DBF databases at the same time:
Connect to SQL Server:
Setpointer (hourglass !)
// The window is in the middle
F_center (this)
// A set of different sgselect connections
String sselect
String temp
Sselect = "d_gdzc" + sgselect
Sqlca. dbparm = profilestring (gzinifile, "Database", "dbparm ","")
Sqlca. DBMS = profilestring (gzinifile, "Database", "DBMS ","")
Sqlca. Database = sselect
Sqlca. servername = profilestring (gzinifile, "Database", "servername ","")
Sqlca. logid = "sa"
Registryget ("HKEY_CURRENT_USER/software/Microsoft/Windows/CurrentVersion/Explorer/g", "A", regstring !, Temp)
F_anencrypt (temp, sqlca. logpass)
Sqlca. autocommit = false
Sqlca. Lock = profilestring (gzinifile, "Database", "Lock ","")
Connect using sqlca;
If sqlca. sqlcode <> 0 then
MessageBox ("lost connection ",&
"Cannot be connected to the data base! (Error message: "+ sqlca. sqlerrtext + ")")
Setpointer (arrow !)
Return
Halt close
End if
Fixed number of letters:
Fuction f_connectdbf (string sdbparm) return any
String NUL // used to generate a null value
Transaction trans_name
Trans_name = create transaction
Trans_name.dbms = "ODBC"
// Trans_name.database = "zwdbf"
// Trans_name.logid =
// Trans_name.logpass =
Trans_name.autocommit = false
Trans_name.dbparm = sdbparm
// Trans_name.lock = profilestring (gzinifile, "Database", "Lock ","")
// Trans_name.dbparm = profilestring (gzinifile, "Database", "dbparm ","")
Connect using trans_name;
If trans_name.sqlcode <> 0 then
MessageBox ("lost connection ",&
"Cannot be connected to financial data warehouse! Check whether the path is correct. (Error message: "+ sqlca. sqlerrtext + ")")
Rollback;
Return setnull (NUL)
Else
Return trans_name
End if
Connect to the Foxpro Data Base (connect to the second data base at the same time, and connect to the third and fourth databases ):
Openwithparm (w_disp, "connecting the DBF card data library...", parent)
Transaction sqldbf
// Use sqldbf to connect to the finance (solid-capital) Data Base
Sqldbf = f_connectdbf ("connectstring = 'dsn = gzdbf '")
// Determine whether the disconnection is successful.
If isnull (sqldbf) then
MessageBox ("error", "error occurred when connecting to DBF fixed asset data database! ")
End if