If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Team_ID Automatic Generation stuck at 999

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-27-10, 13:15
hackingarena hackingarena is offline
Registered User
 
Join Date: Jul 2010
Posts: 39
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
Reply With Quote
  #2 (permalink)  
Old 08-27-10, 14:07
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,075
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? ***
Reply With Quote
  #3 (permalink)  
Old 08-27-10, 14:13
hackingarena hackingarena is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 08-27-10, 14:48
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,075
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? ***
Reply With Quote
  #5 (permalink)  
Old 08-30-10, 05:55
myle myle is offline
(Making Your Life Easy)
 
Join Date: Feb 2004
Location: New Zealand
Posts: 1,143
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
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On