Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 4th, 2004, 08:46 PM
Authorized User
 
Join Date: Mar 2004
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gmoney060 Send a message via MSN to gmoney060
Default Database Entry Problems

Hello. The script I am working on is below. It is saying that the array value "SplitUser(0)" Is out of range. If I would put the code, in red, into the actual script, all the arrays i am trying to get do have a value, but for some reason they are like not being found. Any help would be great! Thanks a lot! **THE RED IS NOT ACTUALLY IN THE SCRIPT I WANT, JUST DID IT TO MAKE SURE THERE ARE VALUES FOR THE ARRAY ELEMENTS!

Code:
For UserCount = LBound(Users) To UBound(Users)
    SplitUser = Split(Users(UserCount),",",-1,1)
    PlayerInfo.AddNew
    For SplitCounter = LBound(SplitUser) To UBound(SplitUser)
        Response.Write SplitUser(SplitCounter) & "<BR>"
    Next
    PlayerInfo("TournamentID") = TournamentID
    PlayerInfo("PinNumber") = SplitUser(0)
    PlayerInfo("FirstName") = SplitUser(1)
    PlayerInfo("LastName") = SplitUser(2)
    PlayerInfo.Update
Next
 
Old November 4th, 2004, 09:29 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hello,

  I think you generated array by storing a list of values from a database.

while not Rs.EOF
   strValues=strValues & Rs(fieldname) & ","
   Rs.MoveNext
wend

At this situation, you should not loop the counter upto UBOUND

For UserCount = LBound(Users) To UBound(Users)-1
    SplitUser = Split(Users(UserCount),",",-1,1)
    PlayerInfo.AddNew
    PlayerInfo("TournamentID") = TournamentID
    PlayerInfo("PinNumber") = SplitUser(0)
    PlayerInfo("FirstName") = SplitUser(1)
    PlayerInfo("LastName") = SplitUser(2)
    PlayerInfo.Update
Next



Hope this works.



--------------
Rajani

 
Old November 4th, 2004, 09:30 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Oh!

   Instead of LBound()

You can start the loop from 0.


---------
Rajani

 
Old November 4th, 2004, 10:08 PM
Authorized User
 
Join Date: Mar 2004
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gmoney060 Send a message via MSN to gmoney060
Default

nope, sorry... Still does not work

 
Old November 9th, 2004, 08:19 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Gmoney060,

Quote:
quote:It is saying that the array value "SplitUser(0)" Is out of range.
Chances are, the array can hold nothing at that point, so that even when used the ZERO subscript it returns error. Check if the array has something in it, using
Code:
If UBOUND(SplitUser)>0 then
... use the FOR LOOP here.
End If
Check that before you run a for loop for that.

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Checking for duplicate entry in Database sharon5469 ASP.NET 1.0 and 1.1 Basics 1 November 18th, 2007 06:08 PM
Reuse form for database entry kwng Pro VB Databases 0 April 30th, 2007 02:26 PM
Searching a database for an entry sconineuk VB.NET 2002/2003 Basics 6 March 24th, 2006 12:25 AM
Database entry from HTML forms gmoney060 Classic ASP Basics 4 March 31st, 2004 04:50 AM
Database Double Entry isg2000 Access ASP 1 June 13th, 2003 04:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.