Win32 Com + ADO: How to compare the result of a recordset to 'nothing'

Bob Gailer bgailer at alum.rpi.edu
Mon Sep 15 10:51:31 EDT 2003


At 07:53 AM 9/15/2003, Felix McAllister wrote:
>[snip]
>The code is as follows:
>###########################3
>import win32com.client
>conn = win32com.client.Dispatch("ADODB.Connection")
>conn.ConnectionString = "Driver={SQL 
>Server};Server=(local);Database=Test;Trusted_Connection=yes;"
>conn.Open()
>rs = conn.Execute("TestSPXML")[0]
>xmlString = ""
>while rs != None:
>     rs.MoveFirst()    # FAILS HERE ON THE SECOND ITERATION OF THE LOOP
>     while not rs.EOF:
>         xmlString = xmlString + rs.Fields[0].Value
>         rs.MoveNext()
>     rs = rs.NextRecordSet()
>print xmlString
>conn.Close()

I am learning how to use ADODB with SQL Server, so your example is very 
timely. I know that I have to change the ConnectionString, as I get this 
error when running your example: "'Microsoft OLE DB Provider for ODBC 
Drivers', '[Microsoft][ODBC SQL Server Driver][Shared Memory]SQL Server 
does not exist or access denied.'"

What do I have to change?

Bob Gailer
bgailer at alum.rpi.edu
303 442 2625
-------------- next part --------------

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.506 / Virus Database: 303 - Release Date: 8/1/2003


More information about the Python-list mailing list