Hello Everyone,
I am moving DBFCDX to MS SQL and I was hoping to get some feedback on the best way to TOleAuto connection, recordset, open and data refresh
- Is the best way to establish SQL connection and execute SQL statement
TRY
oSql:=TOleAuto():New("ADODB.Recordset")
CATCH
MsgInfo("It seems that your PC does not have MDAC installed OR MDAC is corrupted.")
RETURN (.F.)
END
MsgInfo( "ADODB.Recordset OK!")
// Set...
oSql:CursorType := 1 // opendkeyset
oSql:CursorLocation := 3 // local cache
oSql:LockType := 3 // lock opportunistic
// Set SQL string...
cSql := "SELECT * FROM SalesOrderHeader"
TRY
oSql:Open( cSql, 'Provider='+xPROVIDER+';Data Source='+xSOURCE+';Initial Catalog='+xCATALOG+';User Id='+xUSERID+';Password='+xPASSWORD )
CATCH oError
MsgWait("Failed to Connect to the Database")
RETURN (.F.)
END
MsgInfo( oSql:RecordCount )
-
Can I use same oSql to execute another SQL statement on another table?
-
How do I handle data refreshes from the SQL statement in item 1. ( "SELECT * FROM SalesOrderHeader" )
Thank you,