Re: bug in ADOX.catalog with SQL Server 7.0 ?
From: Val Mazur (group51a_at_hotmail.com)
Date: 03/06/04
- Next message: Val Mazur: "Re: connection problem to SQL Server 2000"
- Previous message: Val Mazur: "Re: How to tell if a transaction is open"
- In reply to: steve: "bug in ADOX.catalog with SQL Server 7.0 ?"
- Next in thread: steve: "Re: bug in ADOX.catalog with SQL Server 7.0 ?"
- Reply: steve: "Re: bug in ADOX.catalog with SQL Server 7.0 ?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 5 Mar 2004 23:08:33 -0500
Hi Steve,
Actually ADOX was designed for using with Access and does not support
everything if you work with SQL Server. There is a lot of functionality,
which is not supported in ADOX when you work with SQL Server. Best way is to
use SQL DMO library, which is similar to ADOX, but designed specifically for
SQL Server
--
Val Mazur
Microsoft MVP
"steve" <stevetallard@yahoo.fr> wrote in message
news:edffa387.0403050746.3b2919dc@posting.google.com...
> I' m facing a strange problem using ADOX.Catalog on SQL Server 8.0.194
> When querying a view using ADOX objects, I loose the original types of
> some fields.
>
> Here is a code snippet ( in python ):
>
> def display_type_catalog(v_sTableName, v_sCatalog ):
> print "===============> With ADOX.Catalog
> <========================="
> conn = open_connection( v_sCatalog )
> cat = win32com.client.Dispatch( r"ADOX.Catalog")
> cat.ActiveConnection = conn
> tabs = cat.Tables
> t = tabs[v_sTableName]
> if t.Name == v_sTableName:
> for colum in t.Columns:
> print colum.Name , " ===> " ,
> TypeInfo.alltypesinfo[colum.Type].m_adotype
> print
> print
> return
>
> def display_type_recordset(v_sTableName, v_sCatalog ):
> print "===============> With ADODB.Recordset
> <========================="
> conn = open_connection( v_sCatalog )
> rs = win32com.client.Dispatch( r"ADODB.Recordset")
> l_sQuery = "Select * from " + v_sTableName
> rs.Open(str(l_sQuery) , conn, 1,3)
> for colum in rs.Fields:
> print colum.Name , " ===> " ,
> TypeInfo.alltypesinfo[colum.Type].m_adotype
> print
> print
> return
>
>
> def open_connection(v_sCatalog ):
> conn = win32com.client.Dispatch(r'ADODB.Connection')
> DSN = "Provider=SQLOLEDB;Data Source=LEDIAG;Initial
> Catalog=%s;User ID=sa;Pwd=nissan" % ( v_sCatalog )
> try:
> conn.Open( DSN )
> return conn
> except :
> raise SQLServerError("Impossible de se connecter à la base
> avec le DSN:" + DSN )
>
>
> def main( v_sTableName , v_sCatalog ):
> display_type_catalog(v_sTableName, v_sCatalog )
> display_type_recordset( v_sTableName, v_sCatalog )
>
> try:
> tablename = sys.argv[1]
> catalog = sys.argv[2]
> except:
> print sys.argv[0] , " <TABLE/VIEW> " , "<CATALOG>"
>
> main( tablename , catalog )
>
>
> Running that code on a local view,I obtain :
>
> ===============> With ADOX.Catalog <=========================
> SCE_CODE ===> adInteger
> SCE_NAME ===> adVarWChar
> SCE_IS_DOMAIN_SCE ===> adBoolean
> SCE_TYPE ===> adUnsignedTinyInt
> SCE_DEFAULT_TOOL_TARGET ===> adInteger
> CALC_PRINCIPAL ===> adInteger
> CALC_SECONDAIRE ===> adInteger
> UTI_NOM ===> adVarChar
> VER_NUMBER ===> adDouble
> VER_FILING_DATE ===> adDBTimeStamp
> VER_COMMENTARY ===> adLongVarChar
> VER_EN_COURS ===> adBoolean
>
>
> ===============> With ADODB.Recordset <=========================
> SCE_CODE ===> adInteger
> SCE_NAME ===> adVarWChar
> SCE_IS_DOMAIN_SCE ===> adBoolean
> SCE_TYPE ===> adUnsignedTinyInt
> SCE_DEFAULT_TOOL_TARGET ===> adInteger
> CALC_PRINCIPAL ===> adInteger
> CALC_SECONDAIRE ===> adInteger
> UTI_NOM ===> adVarChar
> VER_NUMBER ===> adDouble
> VER_FILING_DATE ===> adDBTimeStamp
> VER_COMMENTARY ===> adVarWChar
> VER_EN_COURS ===> adBoolean
>
>
>
> where type of field VER_COMMENTARY is different between ADO and ADOX.
>
> field VER_COMMENTARY is defined as nvarchar( 255) both in original
> table and final view ...
>
>
> Anyone has faced this problem before ? Anyone has a workaround ?
>
>
> Thanks for your help
>
> Stephane
>
> Please CC to : stevetallard at yahoo.fr
- Next message: Val Mazur: "Re: connection problem to SQL Server 2000"
- Previous message: Val Mazur: "Re: How to tell if a transaction is open"
- In reply to: steve: "bug in ADOX.catalog with SQL Server 7.0 ?"
- Next in thread: steve: "Re: bug in ADOX.catalog with SQL Server 7.0 ?"
- Reply: steve: "Re: bug in ADOX.catalog with SQL Server 7.0 ?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
Loading