Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #21 (permalink)  
Old February 16th, 2007, 11:50 AM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

here is the file, plz see if u could find out where is the mistake .....

sSim_num = Request.Form("sSim_num")
    sSim_host = split(Request.Form("sSim_host"),"|")
    sSim_dir = split(replace(Request.Form("sSim_dir"),"\","\\")," |")
    sSim_ip = split(Request.Form("sSim_ip"),"|")
    sSim_suid = split(Request.Form("sSim_suid"),"|")
    sSim_numBES = split(Request.Form("sSim_numBES"),"|")
    sSim_startPIN = split(Request.Form("sSim_startPIN"),"|")
    sSim_numPIN = split(Request.Form("sSim_numPIN"),"|")
    sSim_dupPIN = Request.Form("sSim_dupPIN")
    sSim_authKey = split(Request.Form("sSim_authKey"),"|")
    sSim_mthpyldsize = split(Request.Form("sSim_mthpyldsize"),"|")
    sSim_contype = split(Request.Form("sSim_contype"),"|")

    for i=0 to (sSim_num-1)
LINE 78 :Sql = "insert into srpcSims values (null,"&projID&",'"&sSim_host(i)&"','"&sSim_dir(i) &"','"&sSim_ip(i)&"',"&sSim_suid(i)&","&sSim_numBE S(i)&","&sSim_startPIN(i)&","&sSim_numPIN(i)&","&s Sim_dupPIN&",'"&sSim_authKey(i)&"','"&sSim_mthpyld size(i)&"','"&sSim_contype(i)&"')"
        db_conn.execute(sql)
    next

    db_rec.close
    db_conn.close
    set db_rec = nothing
    set db_con = nothing

else

    projName = Request.Form("projName")
    projComments = Request.Form("projComments")
    modName = Request.Form("modName")

    set db_conn = server.createobject("adodb.connection")
    'db_connstr = "Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=testdb; uid=root; pwd=bb3ngtr4.; port=3306; option=16386;"
    db_conn.open(db_connstr)

    updateFolderName()


    sql = "update projects set modDate='"&DatePart("YYYY", Date)&"-"&DatePart("M", Date)&"-"&DatePart("D", Date)&"', modName='"&modName&"', projName='"&projName&"', projComments='"&projComments&"' where id="&projID
    db_conn.execute(sql)

sSim_num = Request.Form("sSim_num")
    sSim_host = split(Request.Form("sSim_host"),"|")
    sSim_dir = split(replace(Request.Form("sSim_dir"),"\","\\")," |")
    sSim_ip = split(Request.Form("sSim_ip"),"|")
    sSim_suid = split(Request.Form("sSim_suid"),"|")
    sSim_numBES = split(Request.Form("sSim_numBES"),"|")
    sSim_startPIN = split(Request.Form("sSim_startPIN"),"|")
    sSim_numPIN = split(Request.Form("sSim_numPIN"),"|")
    sSim_dupPIN = Request.Form("sSim_dupPIN")
    sSim_authKey = split(Request.Form("sSim_authKey"),"|")
      sSim_mthpyldsize = split(Request.Form("sSim_mthpyldsize"),"|")
      sSim_contype = split(Request.Form("sSim_contype"),"|")

    sql = "delete from srpcSims where id="&projID
    db_conn.execute(sql)
    for i=0 to (sSim_num-1)
        sql = "insert into srpcSims values (null,"&projID&",'"&sSim_host(i)&"','"&sSim_dir(i) &"','"&sSim_ip(i)&"',"&sSim_suid(i)&","&sSim_numBE S(i)&","&sSim_startPIN(i)&","&sSim_numPIN(i)&","&s Sim_dupPIN&",'"&sSim_authKey(i)&"','"&sSim_mthpyld size(i)&"','"&sSim_contype&"')"
        db_conn.execute(sql)
    next

    'generationDate = Request.Form("date")
    'sql = "insert into generationDates values (" & projID & ",'" & generationDate & "')"
    'db_conn.execute(sql)

    'db_rec.close
    db_conn.close
    set db_rec = nothing
    set db_conn = nothing

end if

Reply With Quote
  #22 (permalink)  
Old February 16th, 2007, 11:51 AM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i want to add these last two rows
sSim_mthpyldsize = split(Request.Form("sSim_mthpyldsize"),"|")
sSim_contype = split(Request.Form("sSim_contype"),"|")

before adding these everything was working fine .

Reply With Quote
  #23 (permalink)  
Old February 16th, 2007, 12:31 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hey dparsons
did u see anything there or any more info is needed ... PLZ advise !

Reply With Quote
  #24 (permalink)  
Old February 16th, 2007, 12:35 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

your problem, i think, is that you are making a dynamic array by calling Split() in your variable initialization so, my guess is, some of your arrays have more fields then others which is why your getting the out of bounds error.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
Reply With Quote
  #25 (permalink)  
Old February 16th, 2007, 12:41 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

k , but the thing is , it was working fine before i added these two lines
sSim_mthpyldsize = split(Request.Form("sSim_mthpyldsize"),"|")
      sSim_contype = split(Request.Form("sSim_contype"),"|")
so plz tell me how do i fix it .. actually i'm a beginner in this ..so i would request you to elaborate a bit more as to how should i fix the problem.

Reply With Quote
  #26 (permalink)  
Old February 16th, 2007, 12:48 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Remove those 2 lines above. Does your code work fine? If yes then this is the reason why.

Consider this string:
This|is|only|a|test

When i call split on this it will give me an array whos upperbound element is 4 so doing this
response.write(myArray(4)) will write test to the screen.

Now consider this string
Hello|World|!

When i call split on this string I will get an array whos upper bound element is 2 so response.write(myArray2(2)) gives me !.

Now, if i create a loop that does this:

for i=0 to UBound(myArray1)
 response.write(myArray1(i))
 response.write(myArray2(i))
next

This code will generate an error when i gets to 3 because there is no 4th dimension to myArray2. In your example code, all of your arrays have to have the SAME number of dimensions or your code will error out as it is doing right now.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
Reply With Quote
  #27 (permalink)  
Old February 16th, 2007, 12:55 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

k i understand what u mean ...now my question is :
see i have a web application which allows the user to change arguments for certain directives in a config file .Now i want to be able to add these two options ... for example in this code
mthpyldsize default value is say 34000 34000 ..it should appear on the form and user should be able to change to any value ....so for that i guess i had to add to new arrarys which i just did by adding those 2 lines ...so how do i check whats the upper bound to these new lines ? plz advise.

Reply With Quote
  #28 (permalink)  
Old February 16th, 2007, 01:55 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Dim i

i = UBound(myArray)

That will give you an int value of the upper bound dimension of the supplied array.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
Reply With Quote
  #29 (permalink)  
Old February 16th, 2007, 03:31 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm getting this error
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
Unknown column 'abcd' in 'field list'
/save_inc.asp, line 46

for i=0 to (sSim_num-1)
        sql = "insert into srpcSims values (null,"&projID&",'"&sSim_host(i)&"','"&sSim_dir(i) &"','"&sSim_ip(i)&"',"&sSim_suid(i)&","&sSim_numBE S(i)&","&sSim_startPIN(i)&","&sSim_numPIN(i)&","&s Sim_dupPIN&",'"&sSim_authKey(i)&"','"&sSim_mthpyld size(i)&"','"&sSim_contype(i)&"')"
            db_conn.execute(sql)
Plz help ....

Reply With Quote
  #30 (permalink)  
Old February 16th, 2007, 03:32 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Ok I am not going to solve this one for you and here is why: It is obvious that you are a beginner and need help and I don't mind helping people thats why i am here. Unfortunately, you are not going to learn anything if I keep solving your problems and, to quote woodyz from one of his posts, "Experience is what makes you an expert".

Part of the expereince is dealing with the ASP Interperter and figuring out what it is telling you and, in your example it is telling you that it is expecting an end of statement so figure it out!. Here is a hint: check to make sure all of your & ' and " are in their correct places.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
plz.....plz solve out my problem.... kethireddy435 ASP.NET 1.x and 2.0 Application Design 1 October 4th, 2007 12:56 PM
plz help me ASAP developer.ibm Java Basics 4 August 22nd, 2007 12:32 PM
Need Help ASAP coding C# 1 June 6th, 2007 12:41 AM
Plz Help ASAP phantom3008 Classic ASP Basics 3 March 2nd, 2007 05:55 PM
HELP! HELP! Please ASAP iamucha Access 2 March 25th, 2004 11:42 AM



All times are GMT -4. The time now is 12:33 AM.


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