> 

> I’m using pyodbc to interact with MS SQL Server and I’m starting to support 
> mysql.  My issue is that when I use a parameterized query, it works for SQL 
> Server, but crashes when I point to MySQL.  Is there a different syntax that 
> I should be using? or module?
>  
> EG
> Import pyodbc
>  
> def openCursor(DSN):
>     cnxn=pyodbc.connect(('DSN=%s')%DSN)
>     cursor=cnxn.cursor()
>     return cnxn,cursor
>  
> lParams=[<list of parameters excracted from file>]
> query='insert into RestaurantTable values (?, ?, ?, ?, ?, ?, ?, ?, ?)'
>  
> #SQL Server Works
> scnxn,scursor = openCursor(SQLServer)
> scursor.execute(query,lParams)
> scnxn.commit()
> scnxn.close()
>  
> #This Query bombs out and crashes my IDLE shell.  No transactions are 
> commited.
> mcnxn,mcursor = openCursor(MySQL)
> mcursor.execute(query,params)
> mcnxn.commit()
> mcnxn.close()
>  
>  
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to