CodeSmith Community
Your Code. Your Way. Faster!

Error accessing table schema with SchemaExplorer on Sybase SQL Anywhere

Latest post 04-16-2008 8:47 PM by blake05. 2 replies.
  • 04-15-2008 11:05 AM

    Error accessing table schema with SchemaExplorer on Sybase SQL Anywhere

    With the latest CodeSmith 4.1.3 Professional version bought last week I tried to use the SchemaExlorer on a Sysbase SQL Anywhere database, both Sybase version 9 on a Windows 2003 system, and a Sybase version 10 on a Vista 64bit platform with the following template:

    <%@ CodeTemplate Language="C#" TargetLanguage="Text" Description="Sybase test" %>
    <%@ Property Name="SourceDatabase" Type="SchemaExplorer.DatabaseSchema" Category="Context" Description="Database containing the tables." %>
    <%@ Assembly Name="SchemaExplorer" %>
    <%@ Import Namespace="SchemaExplorer" %>
    List of tables in database:
    <% for (int i = 0; i < SourceDatabase.Tables.Count; i++) { %>
        <%= SourceDatabase.TablesIdea.Name %>
        Number of columns<%=SourceDatabase.TablesIdea.Columns.Count%>
    <% } %>

    The connection string I use is:
    "Provider=ASAProv.90;Password=sql;Persist Security Info=True;User ID=dba;Data Source=TestDB;Location=c:\prj\dft\TestDB.db"

    Whenever I try to access some column specific data of a table, CodeSmith crashes with the following error message:

    System.Runtime.InteropServices.COMException (0x800A0CC1): Ein Objekt, das dem angeforderten Namen oder dem Ordinalverweis entspricht, kann nicht gefunden werden.
    at ADOX.Properties.get_Item(Object Item)
    at SchemaExplorer.ADOXSchemaProvider.GetTableColumns(String connectionString, TableSchema table)
    at SchemaExplorer.TableSchema.get_Columns()
    at _CodeSmith.Test_cst.__RenderMethod1(TextWriter writer, Control control)
    at CodeSmith.Engine.DelegateControl.Render(TextWriter writer)
    at CodeSmith.Engine.Control.RenderChildren(TextWriter writer)
    at CodeSmith.Engine.Control.Render(TextWriter writer)
    at CodeSmith.Engine.CodeTemplate.Render(TextWriter writer)
    at CodeSmith.Engine.CodeTemplate.RenderToString()
    at ej.s()

    If I remove the line "Number of columns<%=SourceDatabase.TablesIdea.Columns.Count%>" from the template, everything runs fine and I can see the names of all the tables within the selected database in the template output.

    As the TestDB database contains more than 50 tables with up to 250 columns each, I thought it would be too complex, but the problem also occurs on a newly created database with only one table containing two fields (an integer and a string field).

    If you want to test that behaviour, you can download a free developer edition of Sybase SQL Anywhere 10 from the Sybase website.

    Any idea how to fix this? There seems to be a problem in the ADOXSchemaProvider.dll, but I don´t have the current source code for this.

    Filed under: ,
    • Post Points: 60
  • 04-15-2008 6:58 PM In reply to

    • blake05
    • Top 25 Contributor
    • Joined on 04-03-2008
    • Wisconsin
    • Posts 416
    • Points 7,635

    Re: Error accessing table schema with SchemaExplorer on Sybase SQL Anywhere

    Hello,

    It looks like the problems you are encountering are coming from the ADOXSchemaProvider, I went and checked and saw that we had a really old Sybase SQL Provider (http://community.codesmithtools.com/forums/t/990.aspx), that doesn’t work.  I’ll see if I can find an updated version and try to reproduce the above.

    Thanks

    -Blake Niemyjski

    Blake Niemyjski

    CodeSmith Tools, LLC Support Specialist

    Blog: http://windowscoding.com/blogs/blake/

    ----------------------------------------------------------------------
     Member of the .NetTiers team | Visit http://www.nettiers.com
    ----------------------------------------------------------------------

    • Post Points: 5
  • 04-16-2008 8:47 PM In reply to

    • blake05
    • Top 25 Contributor
    • Joined on 04-03-2008
    • Wisconsin
    • Posts 416
    • Points 7,635

    Re: Error accessing table schema with SchemaExplorer on Sybase SQL Anywhere

    Hello,

    I forgot to mention previously that all the provider source code can be found locally in your CodeSmith folder (C:\Users\Administrator\Documents\CodeSmith\Samples\v4.1\Projects\ADOXSchemaProvider). So feel free to play around with it. If are able to fix this bug, please attach it to this post for others to download.

    Also there will be no updates to the old Sybase Provider as the ADOX Provider has taken its place.

    Thanks

    -Blake Niemyjski

    Blake Niemyjski

    CodeSmith Tools, LLC Support Specialist

    Blog: http://windowscoding.com/blogs/blake/

    ----------------------------------------------------------------------
     Member of the .NetTiers team | Visit http://www.nettiers.com
    ----------------------------------------------------------------------

    • Post Points: 5
Page 1 of 1 (3 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems