Nchars as PrimaryKeys

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • markmcgookin
    Recognized Expert Contributor
    • Dec 2006
    • 648

    Nchars as PrimaryKeys

    Hi All,

    I am working on a project at the moment using SQL Server CE and in my login/user details database I have a user table with the individual username as a primary key.

    I am trying to query this using entityspaces LoadByPrimaryKe y function, which works fine.... but only if the username is all text, if I throw a numeric character in there it always comes back false.

    I can't understand this as they are all essentially characters, the DB knows they are not numeric values, and I have tried explicit convert.toStrin g type methods on the variable being passed, but none of this seems to work.

    Does anyone have any ideas/solutions to this kind of thing? Or has anyone experienced it before.

    Cheers,

    Mark
  • RedSon
    Recognized Expert Expert
    • Jan 2007
    • 4980

    #2
    Is your database expecting a buffer of chars but you throw a number in there and interprets it as a value thereby making the array invalid?

    This sounds more like a database engine problem then a embedded/mobile problem. What database are you using?

    Comment

    • markmcgookin
      Recognized Expert Contributor
      • Dec 2006
      • 648

      #3
      Originally posted by RedSon
      Is your database expecting a buffer of chars but you throw a number in there and interprets it as a value thereby making the array invalid?

      This sounds more like a database engine problem then a embedded/mobile problem. What database are you using?
      It was SQL Server CE 3.0. I still have no idea why it was happening, but fortunatly I solved another problem that was forcing me to use the Nchar as the PK and now have a uniqueidentifie r guid based entity, thus avoiding having to deal with this problem! hehe :P

      Comment

      Working...