SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    Feb 2008
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    it's working but??

    hi sir (NightStalker-DNS)
    in page_load:
    Dim ran As Random = New Random()
    ID.Text = ran.Next().ToString()
    this is working each time it will generate IDs like--
    1221616441
    687947223
    922857540 etc
    but sir suppose i want to start from 1,2,3... instead of above number???

    again one more question is if it will work then suppose user come and only load this form and suppose 3 ID is generated but he will close the form (means not interstate) .after some time another user can load the page so how it will possible that he can get ID 3 as first user can not fill information with 3 so i don't want to skip the number 3,because i want series in database is 1,2,3,4.....

  2. #2
    Non-Member
    Join Date
    Jun 2007
    Posts
    167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    Then you should increment your ID (1,2,3,....), not to use the random one.

    Regards

  3. #3
    An average geek earl-grey's Avatar
    Join Date
    Mar 2005
    Location
    Ukraine
    Posts
    1,403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sat147 View Post
    hi sir (NightStalker-DNS)
    in page_load:
    Dim ran As Random = New Random()
    ID.Text = ran.Next().ToString()
    this is working each time it will generate IDs like--
    1221616441
    687947223
    922857540 etc
    but sir suppose i want to start from 1,2,3... instead of above number???

    again one more question is if it will work then suppose user come and only load this form and suppose 3 ID is generated but he will close the form (means not interstate) .after some time another user can load the page so how it will possible that he can get ID 3 as first user can not fill information with 3 so i don't want to skip the number 3,because i want series in database is 1,2,3,4.....
    Any particular reason why do you need a consequtive serie without gaps?

  4. #4
    SitePoint Member
    Join Date
    Feb 2008
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi sir
    i have this idea sir but i don't know where to write this code and which code?
    i tried for loop but where to increment i don't get it
    pl z sir i am fresher and i need u r help.... can u send me these 2-3 line code??

  5. #5
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,878
    Mentioned
    46 Post(s)
    Tagged
    0 Thread(s)
    Just another question... do you have to display the ID to the user on the registration page?

  6. #6
    SitePoint Member
    Join Date
    Feb 2008
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no sir i don't have ID in database ,database will contain this ID after filling form ,so i want to generate it when user will load this page

  7. #7
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,878
    Mentioned
    46 Post(s)
    Tagged
    0 Thread(s)
    Hi

    Ok, the best way then is just create an ID column in ur db which is the primary key and set the auto increment and the seed to one.

    Then just insert the data into all the columns except for the ID column, which will be automatically inserted for you and it will not duplicate the numbers either.

    How u setup the db exactally will be according to wat db you are using. If you want more help, u will need to let us know wat it is.

  8. #8
    SitePoint Member
    Join Date
    Feb 2008
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi
    i am using a sql server with express edition .
    so according to u there is need to set auto increment option to the ID filed ,is there a way in sql server at the time of table creation ??
    if s then how?

  9. #9
    SitePoint Member
    Join Date
    Feb 2008
    Posts
    23
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi
    i just know is u r their ??
    from where now??
    it shows ur online ,it is not possible to chat with u about my quires?


Bookmarks

Posting Permissions

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