473,385 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

errors in asp code

<%
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 <styletag
3.no %close tag
4.no </tableclose 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

Oct 12 '06 #1
5 1256
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
<he******@gmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.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 <styletag
3.no %close tag
4.no </tableclose 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

Oct 12 '06 #2
and what do we get for doing your homework for you?
<he******@gmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.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 <styletag
3.no %close tag
4.no </tableclose 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

Oct 12 '06 #3
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/ar...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"
Oct 12 '06 #4
thank you everyone for contributing brilliant!

Oct 12 '06 #5
<he******@gmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.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 <styletag
3.no %close tag
4.no </tableclose 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

Oct 12 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Douglas Buchanan | last post by:
I am using the following code instead of a very lengthly select case statement. (I have a lot of lookup tables in a settings form that are selected from a ListBox. The data adapters are given a...
6
by: Shabam | last post by:
A web application of mine developed using C# + MS SQL runs fine normally. However when I stress test it with a load testing software (using about 60 simultaneous users) some instances start...
8
by: jon morgan | last post by:
OK, I'm going to be brave. There is a bug in VS.Net 1.1 that causes random compiler errors. I have raised this issue in posts at least three time in the past couple of months without attracting...
0
by: doli | last post by:
Hi, I have the following piece of code which iterates through the potential errors: i =0 For Each error_item in myConn.Errors DTSPackageLog.WriteStringToLog myConn.Errors(i).Description...
2
by: Kavitha Rao | last post by:
Hi, I am getting the following errors while trying to run this snippet in Microsoft Visual C++.Can't seem to print the crc value stored. /* +++Date last modified: 05-Jul-1997 */ /* Crc - 32...
10
by: dbuchanan | last post by:
Hello, >From time to time my vb2005 form disappears and is replaced by the following errors. Rebuilding the application never helps. However the errors never affects the operation of my...
24
by: pat | last post by:
Hi everyone, I've got an exam in c++ in two days and one of the past questions is as follows. Identify 6 syntax and 2 possible runtime errors in this code: class demo {
3
by: clintonb | last post by:
Some programmers, and even Microsoft documents, say you should only throw exceptions for exceptional situations. So how are others handling all the other unexceptional errors? How are you...
11
by: Howard Kaikow | last post by:
I'm using the code below, but an error is not getting trapped. Where can such errors occur? In another process? Try SomeCode Catch ex As Exception Dim strMsg() As String = Split(ex.ToString,...
0
by: clemrock | last post by:
Help w/ errors.add_to_base between controller and model Hello, I'm having trouble in routing some errors between model and controller. The errors produced in the controller...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.