We help IT Professionals succeed at work.

Multiple queries on one lsxodbc connection

Hi Experts,

I've got a LotusScript agent (Domino 7) that is
(a) using LSXODBC or LSXLC (both have the same problem)
(b) Accessing data on MS SQL Server 2008
(c) Iterating over one table - header table
(d) For each record in the the header table, fetching details in the second table - detail table

The problem is, the records in the second table are just not being returned if the detail query runs using the same Connection object as the header query. If I create a second connection and use that, everything is fine. Otherwise, only the very last Header record returns anything for the detail record. Hope this makes sense.

If I replace the sql server with an access database connection, there is no problem. Everything works. My guess is something about having references to two result sets over a single connection is causing issues.

So, is there something I need to change on the SQL Server? In the connection? Somewhere? Why would this work for Access, but not for Sql Server?

Appreciate your help.

Comment
Watch Question

Both SQL Server 2005 and 2008 support MARS (Multiple Active Result Sets), but this functionality is not enabled by default. To use MARS when connecting to SQL Server with SQL Server Native Client, you must specifically enable it within a connection string.  
The SQL Server Native Client ODBC driver supports MARS through additions to the SQLSetConnectAttr and SQLGetConnectAttr functions. SQL_COPT_SS_MARS_ENABLED has been added to accept either SQL_MARS_ENABLED_YES or SQL_MARS_ENABLED_NO, with SQL_MARS_ENABLED_NO being the default.
In addition, a new connection string keyword, Mars_Connection, as been added. It accepts "yes" or "no" values; "no" is the default.

Author

Commented:
You're a gem. Thank you.