I've hit my next sticking point in porting adodbapi. <code snippit> try: import win32com.client def Dispatch(dispatch): return win32com.client.Dispatch(dispatch) win32 = True except ImportError: # implies running on IronPython from System import Activator, Type def Dispatch(dispatch): type = Type.GetTypeFromProgID(dispatch) return Activator.CreateInstance(type) win32 = False #implies IronPython # [... much later ...] class Cursor(object): # ... def _executeHelper(self,operation,etc): self.cmd=Dispatch("ADODB.Command") # ... self.cmd.CommandText=operation # ... adoRetVal = self.cmd.Execute() if win32: rs=adoRetVal[0] try: self.rowcount = rs.RecordCount except: self.rowcount = adoRetVal[1] else: # iron Python rs = adoRetVal try: self.rowcount = rs.RecordCount except: # HOW DO I GET THE ROW COUNT ? ? ? self.rowcount= -1 </ code > It appears that, when called from VB, the Execute method takes an optional agument. >From w3schools.com: <quote> ADO Execute Method ------------------------------ [image: Command Object Reference] Complete Command Object Reference<http://www.w3schools.com/ADO/ado_ref_command.asp> ------------------------------
The Execute method executes the query, SQL statement or procedure specified in the CommandText property of the Command object. The results are stored in a new Recordset object if it is a row-returning query. A closed Recordset object will be returned if it is not a row-returning query. Syntax for row-returning Set rs=objcommand.Execute(ra,parameters,options) Syntax for non-row-returning objcommand.Execute ra,parameters,options Parameter Description ra Optional. Returns the number of records affected by a query. For a row-returning query, use the RecordCount property of the Recordset object to count of how many records are in the object. parameters Optional. Parameter values passed with an SQL statement. Used to change, update, or insert new parameter values into the Parameters Collection. options Optional. Sets how the provider should evaluate the CommandText property. Can be one or more CommandTypeEnum<http://www.w3schools.com/ADO/met_comm_execute.asp#commandtypeenum>or ExecuteOptionEnum<http://www.w3schools.com/ADO/met_comm_execute.asp#executeoptionenum>values. Default is adCmdUnspecified. </quote>We can't pass the "ra" parameter in python, so pywin32 returns a tuple with the recordset and the number of records. How do I retrieve the number of records (for a non-row-returning query) in Iron? -- Vernon Cole
_______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com