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
  #1 (permalink)  
Old February 15th, 2007, 01:31 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default Plz Help ASAP

I'm getting this error
Error Type:
Microsoft VBScript runtime (0x800A0009)
Subscript out of range: 'i'
/save_inc.asp, line 78

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_mthpyldsi ze(i)&","&sSim_contype(i)&"')"
    db_conn.execute(sql)
    next

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

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

Now i'm getting an error
Microsoft VBScript runtime (0x800A01C2)
Wrong number of arguments or invalid property assignment: 'replace'
/createCFGs.asp, line 334

do while sqlFile2.AtEndOfStream <> true
Line 334 sqlFile3.writeline(Replace(Replace(Replace(sqlFile 2.ReadLine,"{SID_START}",sSim_sid(i)),"{SID_END}", (CLng(sSim_sid(i))+CLng(sSim_numB(i))-1)&""),"{AUTH_KEY}",sSim_authKey(i),sSim_pyldsize(i),sSim_contype(i)))

i'm trying to add the ones in bold .Plz help

Reply With Quote
  #3 (permalink)  
Old February 15th, 2007, 04:23 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 wow. I would highly recommend you rethinking that process because that is about impossible to read. The replace() function in ASP only takes 3 parameter Replace(string, 'oldvalue', 'newvalue') You have, I think, supplied 5 values to the outer most replace.

================================================== =========
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
  #4 (permalink)  
Old February 15th, 2007, 04:26 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hey , actually i'm beginner in this...
could u plz help me out some more on this ...what other info is needed to solve this prob ?

Reply With Quote
  #5 (permalink)  
Old February 15th, 2007, 04:34 PM
Friend of Wrox
Points: 2,101, Level: 18
Points: 2,101, Level: 18 Points: 2,101, Level: 18 Points: 2,101, Level: 18
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , .
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

Try your replace statements one at a time until you get them all to run without errors and then you can consider combining them together. Or get one working, then add a Replace and then another.

Reply With Quote
  #6 (permalink)  
Old February 15th, 2007, 04:38 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 s1, s2, s3

s3 = Replace(sqlFile2.ReadLine,"{SID_START}",sSim_sid(i ))
s2 = Replace(s3,"{SID_END}",(CLng(sSim_sid(i))+CLng(sSi m_numB(i))-1)&"")
s1 = Replace(s2, "{AUTH_KEY}",sSim_authKey(i),sSim_pyldsize(i),sSim _contype(i)) <-- this line is going to error everytime like this, you have way to many parameters

In so far as a solution, remember that a replace statement only takes 3 values.

================================================== =========
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
  #7 (permalink)  
Old February 15th, 2007, 05:00 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

k ,say if i break it as u suggested then how do i include
sqlFile3.writeline.....with these s3,s2,s1.
actually i was trying to make some changes .. these sSim_pyldsize(i) ,sSim_contype(i) i want to write in seperate lines ...they are of integer and text type respectively . plz advise ?

Reply With Quote
  #8 (permalink)  
Old February 15th, 2007, 05:08 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 original code does not reflect that you are trying to write seperate lines, your code just writes one line for every line in a SQL File.

In any case, if it were me i would do something like

do while sqlFile2.AtEndOfStream <> true
    s3 = Replace(sqlFile2.ReadLine,"{SID_START}",sSim_sid(i ))
    s2 = Replace(s3,"{SID_END}",(CLng(sSim_sid(i))+CLng(sSi m_numB(i))-1)&"")
    s1 = Replace(s2, "{AUTH_KEY}",sSim_authKey(i),sSim_pyldsize(i),sSim _contype(i))

    sqlfile3.writeline(<value you want to write to file>)
loop

================================================== =========
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
  #9 (permalink)  
Old February 15th, 2007, 05:14 PM
Authorized User
 
Join Date: Feb 2007
Location: , , .
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Now when i'm doing the same including
sqlfile3.writeline(sSim_pyldsize(i)) it gives an error

Microsoft VBScript compilation (0x800A03EE)
Expected ')'
/createCFGs.asp, line 334, column 197
sqlFile3.writeline(Replace(Replace(Replace(Replace (Replace(sqlFile2.ReadLine,"{SUID_START}",sSim_sui d(i)),"{SUID_END}",(CLng(sSim_suid(i))+CLng(sSim_n umBES(i))-1)&""),"{AUTH_KEY}",sSim_authKey(i)))



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

Oh k , i got that part ..now its able to write those 2 parameters as well ! thanks a lot


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 03:05 AM.


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