Home All Groups Group Topic Archive Search About
Author
12 Oct 2006 2:49 PM
hemdagem
<%
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

Author
12 Oct 2006 3:12 PM
Slim
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
>
Are all your drivers up to date? click for free checkup

Author
12 Oct 2006 3:39 PM
Bob Barrows [MVP]
Slim wrote:
> 6
> set fs=Server.CreateObject("Scripting.FileSystemObject")
> not
> set fs=CreateObject("Scripting.FileSystemObject")

Not true. This is purely optional. The vbscript version has been reported to
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

>
> 7
> varaibles not declared, must be delcared if using option explicit

By declaring, Slim means to use a "dim" statement, as in:

dim again

>
> 8
> middlecolumn = sqr(rep) * lg(rep) what is lg()

Slim is asking this question because vbscript has no builtin function called
lg(), and you do not seem to have created an array called lg()

> 10
> response.write("<td>" + leftcolumn + </td>") &
>
> Use "&" not "+"

Good coding practice, but usually not a cause of errors.

>
> also these lines are unnesasary
>
> response.buffer = false
> server.timeout = 10000
>
Sure, the timeout is probably unnecessary, but maybe the buffer is not
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"
Author
12 Oct 2006 3:34 PM
hempguy
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
>
Author
12 Oct 2006 4:00 PM
hemdagem
thank you everyone for contributing brilliant!
Author
12 Oct 2006 4:10 PM
Mike Brind
<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
>

The easiest way to identify errors is to run the code and see at which line
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

Bookmark and Share