Results 1 to 2 of 2

Thread: Negative Autonumbers in Query Fill?

  1. #1

    Thread Starter
    Hyperactive Member Quasar6's Avatar
    Join Date
    Mar 2008
    Location
    Sol 3
    Posts
    325

    Negative Autonumbers in Query Fill?

    Hi all. I'm experiencing a very weird situation regarding one of my SQL queries being fed into my C# app via a DataTable.

    Short version is: I have a query which gathers information from two related tables, including the Autonumber ID of one table and the userdefined primary key of another. This is being imported as a designer DataTable.

    I've set up an SQL Fill command which filters this DataTable based on the Autonumber field: WHERE ([Table 2].ID IN (x, y, z, ... etc)). This command is generated at runtime, fed into an OleDbDataAdapter, and then Fill is called on this Adapter.

    What I'm getting is this: The correct records are displaying, but the Autonumber field is showing negative numbers and the other primary key isn't displaying at all.

    The negative Autonumber thing isn't actually a problem, I'm hiding this column from the user anyway... but I need the primary key of the other table to be displayed.

    Any suggestions? Thanks.
    Qu.
    Attached Images Attached Images  
    "Why do all my attempts at science end with me getting punched by batman?" xkcd.

    |Pong||
    Sorry for not posting more often.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: Negative Autonumbers in Query Fill?

    Read this.

    If you're not deleting any records and the database will not have multiple users accessing it at the same time then you can safely edit the AutoIncrementSeed and AutoIncrementStep properties of your DataTable's PK column to match the values used by the table in the database.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width