|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
errors in asp code2. option explicit 3. ' 4. set fs=CreateObject("Scripting.FileSystemObject") 5. set tfile=fs.CreateTextFile("c:\somefile.txt") 6. test = "Hello World!" 6. tfile.WriteLine(test) 7. ' 8. response.write("<table>") & vbcrlf 9. ' 10. for again = 1 to 50 11. for rep = 1 to 100 12. leftcolunn = rep 13. middlecolumn = sqr(rep) * lg(rep) 14. rightcolumn = again * rep 15. response.write("<tr>") & vbcrlf 16. response.write("<td>" + leftcolumn + </td>") & vbcrlf 17. response.write("<td>" + middlecolumn + </td>") & vbcrlf 18. response.write("<td>" + rightcolumn + </td>") & vbcrlf 19. response.write("<tr>") & vbcrlf 20. next rep 21. next again 22. ' 23. response.buffer = false 24. server.timeout = 10000 25.' 26. </script> Hi i have to find atleast 5 errors think i found four: 1. leftcolunn should be spelt leftcolumn 2.no <style> tag 3.no %> close tag 4.no </table> close tag help me out please urgent and i have these tasks to do: The following is piece of ASP code which has at least 5 fatal errors - identify what these are and how they can be fixed. B) Suggest a better way to achieve the functionality show in lines 10 to 21 C) When running this code you get a "permission denied" error for line 5. Why is this caused and how could you resolve this issue. D) Write additional ASP code that will send this table generated in lines 10 to 21 as an HTML e-mail to an e-mail address entered into an HTML form on the page. Hemang 5
row needs end tag </tr> 6 set fs=Server.CreateObject("Scripting.FileSystemObject") not set fs=CreateObject("Scripting.FileSystemObject") 7 varaibles not declared, must be delcared if using option explicit 8 middlecolumn = sqr(rep) * lg(rep) what is lg() 9 set tfile=fs.CreateTextFile("c:\somefile.txt") should have true to overwrite existing file, or page can only run once set tfile=fs.CreateTextFile("c:\somefile.txt",true) 10 response.write("<td>" + leftcolumn + </td>") & Use "&" not "+" also these lines are unnesasary response.buffer = false server.timeout = 10000 <hemda***@gmail.com> wrote in message Show quoteHide quote news:1160664545.408359.192520@k70g2000cwa.googlegroups.com... > <% > 2. option explicit > 3. ' > 4. set fs=CreateObject("Scripting.FileSystemObject") > 5. set tfile=fs.CreateTextFile("c:\somefile.txt") > 6. test = "Hello World!" > 6. tfile.WriteLine(test) > 7. ' > 8. response.write("<table>") & vbcrlf > 9. ' > 10. for again = 1 to 50 > 11. for rep = 1 to 100 > 12. leftcolunn = rep > 13. middlecolumn = sqr(rep) * lg(rep) > 14. rightcolumn = again * rep > 15. response.write("<tr>") & vbcrlf > 16. response.write("<td>" + leftcolumn + </td>") & > vbcrlf > 17. response.write("<td>" + middlecolumn + </td>") & > vbcrlf > 18. response.write("<td>" + rightcolumn + </td>") & > vbcrlf > 19. response.write("<tr>") & vbcrlf > 20. next rep > 21. next again > 22. ' > 23. response.buffer = false > 24. server.timeout = 10000 > 25.' > 26. </script> > > Hi i have to find atleast 5 errors think i found four: > > > 1. leftcolunn should be spelt leftcolumn > 2.no <style> tag > 3.no %> close tag > 4.no </table> close tag > > help me out please urgent > > > and i have these tasks to do: > > The following is piece of ASP code which has at least 5 fatal > errors - identify what these are and how they can be fixed. > B) Suggest a better way to achieve the functionality show in lines 10 > to 21 > C) When running this code you get a "permission denied" error for > line 5. Why is this caused and how could you resolve this issue. > D) Write additional ASP code that will send this table generated in > lines 10 to 21 as an HTML e-mail to an e-mail address entered into > an HTML form on the page. > > > Hemang > Slim wrote:
> 6 Not true. This is purely optional. The vbscript version has been reported to > set fs=Server.CreateObject("Scripting.FileSystemObject") > not > set fs=CreateObject("Scripting.FileSystemObject") improve performance vs using the Server object's version. Purely anecdotal but there it is. Using the vbscript version of createobject is not typically a cause for errors. http://blogs.msdn.com/ericlippert/archive/2004/06/01/145686.aspx > By declaring, Slim means to use a "dim" statement, as in:> 7 > varaibles not declared, must be delcared if using option explicit dim again > Slim is asking this question because vbscript has no builtin function called > 8 > middlecolumn = sqr(rep) * lg(rep) what is lg() lg(), and you do not seem to have created an array called lg() > 10 Good coding practice, but usually not a cause of errors.> response.write("<td>" + leftcolumn + </td>") & > > Use "&" not "+" > Sure, the timeout is probably unnecessary, but maybe the buffer is not > also these lines are unnesasary > > response.buffer = false > server.timeout = 10000 > needed on this page ... -- Microsoft MVP - ASP/ASP.NET Please reply to the newsgroup. This email account is my spam trap so I don't check it very often. If you must reply off-line, then remove the "NO SPAM" and what do we get for doing your homework for you?
<hemda***@gmail.com> wrote in message Show quoteHide quote news:1160664545.408359.192520@k70g2000cwa.googlegroups.com... > <% > 2. option explicit > 3. ' > 4. set fs=CreateObject("Scripting.FileSystemObject") > 5. set tfile=fs.CreateTextFile("c:\somefile.txt") > 6. test = "Hello World!" > 6. tfile.WriteLine(test) > 7. ' > 8. response.write("<table>") & vbcrlf > 9. ' > 10. for again = 1 to 50 > 11. for rep = 1 to 100 > 12. leftcolunn = rep > 13. middlecolumn = sqr(rep) * lg(rep) > 14. rightcolumn = again * rep > 15. response.write("<tr>") & vbcrlf > 16. response.write("<td>" + leftcolumn + </td>") & > vbcrlf > 17. response.write("<td>" + middlecolumn + </td>") & > vbcrlf > 18. response.write("<td>" + rightcolumn + </td>") & > vbcrlf > 19. response.write("<tr>") & vbcrlf > 20. next rep > 21. next again > 22. ' > 23. response.buffer = false > 24. server.timeout = 10000 > 25.' > 26. </script> > > Hi i have to find atleast 5 errors think i found four: > > > 1. leftcolunn should be spelt leftcolumn > 2.no <style> tag > 3.no %> close tag > 4.no </table> close tag > > help me out please urgent > > > and i have these tasks to do: > > The following is piece of ASP code which has at least 5 fatal > errors - identify what these are and how they can be fixed. > B) Suggest a better way to achieve the functionality show in lines 10 > to 21 > C) When running this code you get a "permission denied" error for > line 5. Why is this caused and how could you resolve this issue. > D) Write additional ASP code that will send this table generated in > lines 10 to 21 as an HTML e-mail to an e-mail address entered into > an HTML form on the page. > > > Hemang > <hemda***@gmail.com> wrote in message
Show quoteHide quote news:1160664545.408359.192520@k70g2000cwa.googlegroups.com... The easiest way to identify errors is to run the code and see at which line > <% > 2. option explicit > 3. ' > 4. set fs=CreateObject("Scripting.FileSystemObject") > 5. set tfile=fs.CreateTextFile("c:\somefile.txt") > 6. test = "Hello World!" > 6. tfile.WriteLine(test) > 7. ' > 8. response.write("<table>") & vbcrlf > 9. ' > 10. for again = 1 to 50 > 11. for rep = 1 to 100 > 12. leftcolunn = rep > 13. middlecolumn = sqr(rep) * lg(rep) > 14. rightcolumn = again * rep > 15. response.write("<tr>") & vbcrlf > 16. response.write("<td>" + leftcolumn + </td>") & > vbcrlf > 17. response.write("<td>" + middlecolumn + </td>") & > vbcrlf > 18. response.write("<td>" + rightcolumn + </td>") & > vbcrlf > 19. response.write("<tr>") & vbcrlf > 20. next rep > 21. next again > 22. ' > 23. response.buffer = false > 24. server.timeout = 10000 > 25.' > 26. </script> > > Hi i have to find atleast 5 errors think i found four: > > > 1. leftcolunn should be spelt leftcolumn > 2.no <style> tag > 3.no %> close tag > 4.no </table> close tag > > help me out please urgent > > > and i have these tasks to do: > > The following is piece of ASP code which has at least 5 fatal > errors - identify what these are and how they can be fixed. > B) Suggest a better way to achieve the functionality show in lines 10 > to 21 > C) When running this code you get a "permission denied" error for > line 5. Why is this caused and how could you resolve this issue. > D) Write additional ASP code that will send this table generated in > lines 10 to 21 as an HTML e-mail to an e-mail address entered into > an HTML form on the page. > > > Hemang > it falls over. Check the error message, fix it and then run it again. If you don't understand what an error message means, copy it into google or www.aspfaq.com, or even google groups. Two of the errors you've hightlighted aren't fatal, but Slim has already covered some others that are. "Fatal" means that the script will stop running and return and error message to the browser. If it runs fine but looks all messed up, that's the cause of faulty logic or html, not a fatal error. In addition, lines 20 and 21 will stop execution with an 'expected end of statement' error. That syntax is fine for VB and VBA, but not for VBScript. -- Mike Brind
Other interesting topics
Convert the code from gb2312 to unicode in ASP
Carriage Return and Response.Write Output Issue Percentage Calculation question.... New session for every page??? Help in writing SQL using request.form.item(i) displaying a drop down selection with ASP ADODB.Field error '80020009' Cannot find record Request.BinaryRead(count) wierd Multiple sessions, how to kill only one |
|||||||||||||||||||||||