R: Connecting to Microsoft SQL Server
Luca Calderano
calderano at sgaspa.it
Fri May 9 09:08:27 EDT 2003
-----Messaggio originale-----
Hi, All-
Is it possible to connect my Python 2.2 running on Windows 2000
"Professional" to a Microsoft SQL server? I've connected to Access
databases on my local box (thanks to Mark Hammond and Andy Robinson's book),
but can't figure this one out. Can anyone help me?
Thanks!
--greg
have you ever tried with ADO and win32com ???
try this:
self.Cnn = win32com.client.Dispatch(r'ADODB.Connection')
self.ConnStr = r'File Name=C:\Proposte.dsn'
self.Cnn.Open (self.ConnStr)
Cmd =win32com.client.Dispatch(r'ADODB.Command')
Cmd.ActiveConnection = self.Cnn
Cmd.CommandText = 'Stampa_Report'
Cmd.CommandType = adCmdStoredProc
Cmd.CommandTimeout = 15
Prm = win32com.client.Dispatch(r'ADODB.Parameter')
Prm = Cmd.CreateParameter('[@Ndg]',adInteger, adParamInput,8,Ndg)
Cmd.Parameters.Append (Prm)
Rst = win32com.client.Dispatch(r'ADODB.Recordset')
Rst.Open (Cmd)
More information about the Python-list
mailing list