Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2010
    Posts
    39

    Unanswered: Team_ID Automatic Generation stuck at 999

    I have a piece of code in ASP which automatically generated as team_id as teams are added by users and stores team_id value in sql database. This code was working fine until team_ID value reached tm_999 after that this piece of code is allocating team_Id for every team added as tm_* instead of going to tm_1000. Can anybody tell what should i change in order to fix this problem?

    Code:
    '*********** This is code for sequence generation for Team id.
    dim cmd_Nextval
    set cmd_nextval = server.CreateObject ("ADODB.command")
    set p1 = server.CreateObject ("ADODB.Parameter")
    set p2 = server.CreateObject ("ADODB.Parameter")
    
    'Declare Costants
    const adCmdStoredProc = &H0004
    const adChar = 129
    const adParamInput = &H0001
    const adParamOutput = &H0002
    
    cmd_Nextval.ActiveConnection = objConn
    cmd_Nextval.CommandText = "NEXTVAL"
    cmd_Nextval.CommandType = adCmdStoredProc
    
    p1.name = "@seqname"
    p1.type = adChar
    p1.direction = adParamInput
    p1.size = 50
    p1.value = "TEAM"
    
    cmd_Nextval.Parameters.Append (p1)
    
    p2.name = "@pre"
    p2.type = adChar
    p2.direction = adParamOutput
    p2.size = 50
    
    cmd_Nextval.Parameters.Append (p2)
    
    dim teamt_id
    cmd_Nextval.execute
    team_id = p2.Value ' = cmd_Nextval.NamedParameters("pre")
    team_id = trim(team_id)
    
    
    
    '*******************
    Thanks in advance

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Why not let SQL generate the ID for you using an IDENTITY/AutoNumber field and avoid this whole sordid business?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Jul 2010
    Posts
    39
    actually this is an old website baed on classic asp which i have not written, i m just managing it, so after going through all the code, i found out that this piece of code was causing problem, so i thought if i can edit it and let it do the same thing.

    If that's possible for you to tell because there is lots of places where there is a reference to this id and i dont want to mess anything up

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    I'd check the sproc first. Make sure it's returning what you think it is.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  5. #5
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    the asp does not have a count in there it must be in the StoredProc in the SQL database

    and it probabley a varibles is set to the lenght of 3

    I would look for
    DECLARE @???????? varchar(3)
    in the StoredProc

    ??????? being a var name
    hope this help

    See clear as mud


    StePhan McKillen
    the aim is store once, not store multiple times
    Remember... Optimize 'til you die!
    Progaming environment:
    Access based on my own environment: DAO3.6/A97/A2000/A2003/A2007/A2010
    VB based on my own environment: vb6 sp5
    ASP based on my own environment: 5.6
    VB-NET based on my own environment started 2007
    SQL-2005 based on my own environment started 2008
    MYLE
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

Posting Permissions

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