in

CodeSmith Community

Your Code. Your Way. Faster!

HasPrimaryKey: System.Data.SqlTypes.SqlNullValueException

Last post 01-04-2008 9:07 AM by Joel Rewers. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 05-31-2007 1:48 AM

    HasPrimaryKey: System.Data.SqlTypes.SqlNullValueException

    Hi there,

    I've got a strange problem with codemith,  I'm trying to generate code from a database and when I try, I receive the following error message.

    System.Data.SqlTypes.SqlNullValueException: Data is Null. This method or property cannot be called on Null values.

     apparentently the generation fails when I try to access the HasPrimaryKey method of a table.   I looked into the database and the table has a primary key and also an auto increment set on the column with the primary key.

    Now the strange thing is that my collegue also tried to generate code from that same database and he did not get the error message.  We are both using the same version of codesmith. I'm using sql server 2005

    any ideas

     

    thanks

     Joel

     

     

    • Post Points: 65
  • 06-01-2007 9:23 AM In reply to

    • shannon
    • Top 50 Contributor
    • Joined on 03-06-2007
    • Posts 68
    • Points 4,905

    Re: HasPrimaryKey: System.Data.SqlTypes.SqlNullValueException

    Would it be possible to post the table schema and the portion of the template that is failing?
    • Post Points: 5
  • 07-23-2007 3:29 AM In reply to

    • qliu
    • Not Ranked
    • Joined on 07-23-2007
    • Posts 1
    • Points 35

    Re: HasPrimaryKey: System.Data.SqlTypes.SqlNullValueException

     Hi Joel

     I have the same problem, did you find a solution? Thanks.

     

    qliu
     

    • Post Points: 35
  • 01-04-2008 9:07 AM In reply to

    Re: HasPrimaryKey: System.Data.SqlTypes.SqlNullValueException

    Hi,

    I found a solution for me. The thing was that I tried to read the extended properties of a table with a user who was not authorized to do so.

    After changing the user, with a user that had more rights, the thing worked again.

     Joel

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