jmac13
Member
Hi All,
I'm using 10.2b and we've got a project coming up where we will be connecting to a SQL db and updating a table/tables and maybe getting data back. When we have done this in the past we have used the com-handles adodb.connection,adodb.Command & adodb.Recordset. Using a ODBC connection to connect to the SQL DB and thenWe would do the following example (See below) we would say do a Select then go round recordset object and create a temp-table or populate a db table or a Update depending on what we are doing.
Is there a better way of doing this or should I just stick with doing this? thanks
I'm using 10.2b and we've got a project coming up where we will be connecting to a SQL db and updating a table/tables and maybe getting data back. When we have done this in the past we have used the com-handles adodb.connection,adodb.Command & adodb.Recordset. Using a ODBC connection to connect to the SQL DB and thenWe would do the following example (See below) we would say do a Select then go round recordset object and create a temp-table or populate a db table or a Update depending on what we are doing.
Is there a better way of doing this or should I just stick with doing this? thanks
Code:
define variable comConn as com-handle no-undo.
define variable comCmd as com-handle no-undo.
define variable comRS as com-handle no-undo.
create "adodb.connection" comConn.
create "adodb.Command" comCmd.
create "adodb.Recordset" comRS.
comConn :Open("{&DSN}","{&UID}","{&PSW}",-1) no-error.
if not valid-handle(comConn) then return.
comCmd :ActiveConnection = comConn no-error.
comCmd :CommandText = ipChrQuery no-error.
comRS :Open(comCmd, , 3,2,) no-error.