Results 1 to 2 of 2

Thread: AUTO generation (URGEEEEEEEEENT)

  1. #1
    Pari Guest

    Default AUTO generation (URGEEEEEEEEENT)

    hi<BR>i have a table called indent<BR>fields:<BR>idno ( PK)<BR>username<BR>Qty<BR><BR>in the asp page when i enter the records i want to auto increment the idno as username1, username2, username3<BR><BR>the flwng code works only for 10 records <BR>after 10 recs it says pri key violation coz of the max element in the query<BR>can any body suggest any other way of doin this or rectifying this code<BR>&#039 Finds maximum indentno. used for this particular user<BR> sqlstr="select * from indent where userid=&#039"&user&"&#039"<BR> set rs=conn.execute(sqlstr)<BR> if(rs.eof) then<BR> numb = 0<BR> else<BR> &#039 Increases the indent number by one<BR> indentno=rs.fields(0)<BR> response.write(indentno)<BR> numb = mid(indentno,5,10)<BR> response.write(numb)<BR> if (numb="")then<BR> numb=0<BR> end if<BR> numb = numb + 1<BR> <BR> end if<BR> <BR> &#039 concatenates userid with integer part of indent number<BR> indentno = user&numb<BR> rs.close<BR><BR><BR>please any body can help me i ll b greatly obliged<BR>pari<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: AUTO generation (URGEEEEEEEEENT)

    i think you are getting problem with the following line of code,<BR>what is the purpose of using MID for getting no. you can directly use CInt (if i understood correctly)<BR>numb = mid(indentno,5,10)<BR>

Posting Permissions

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