 |
| Classic ASP Professional For advanced coder questions in ASP 3. 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 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

July 30th, 2008, 12:55 AM
|
|
Authorized User
|
|
Join Date: Jul 2008
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
problem to fetch record using while loop
I am using vb script for an Asp application. I also come across the error- time out error when using while loop. I feel inconsistant in using it.
Please give me some suggestions
|
|

July 30th, 2008, 01:35 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
You should post some code for a decent response. The exact error offending code and point to the line number the error refers to
Wind is your friend
Matt
www.elitemarquees.com.au
|
|

July 30th, 2008, 01:38 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
Usually, when you get a timeout from running a loop, it means you have an infinite loop.
If you have something like
Code:
While RS.EOF = False
.... code ...
Wend
Most likely you omitted the line
from inside the loop.
If you never move to a new record, then you will just stay on the same record forever...an infinite loop.
But, as Mat41 said, show your code. Don't make us just guess like this.
|
|

July 30th, 2008, 01:48 AM
|
|
Authorized User
|
|
Join Date: Jul 2008
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The code is
<%
if Request.QueryString("opid")="ViewNewRequest" Then
Dim DepCode
Dim DepCodeRs
Set DepCodeRs=Conn.Execute("Select Des_Dep_Code from Designation where Des_Code=(Select Emp_Desg_Code from EmployeeDetails where Employee_id=" & Session("user") & ")")
DepCode=DepCodeRs(0)
Dim DispRs
Set DispRs=Conn.Execute("Select Serial_No, Applied_Date, emp_code, Project_Code, Location, Status from cd_writing where Emp_Code in (Select Employee_id from EmployeeDetails where Emp_Desg_Code in (Select Des_Code from Designation where Des_Dep_Code=" & DepCode & ")) and Status='P'")
%>
<table width="98%" border="0" cellspacing="1" cellpadding="2" bgcolor="#666666" align="center">
<br>
<tr bgcolor="#aaaaaa">
<td width="5%" align="center"><b>Form
No</b></td>
<td width="15%" align="center"><b>Applied Date</b></td>
<td width="25%" align="center"><b>Person Applied</b></td>
<td width="25%" align="center"><b>Project Name</b></td>
<td width="35%" align="center"><b>Data Location</b></td>
</tr>
<%
While not DispRs.eof
DispRs.Movefirst
%>
<tr>
<td bgcolor="#eeeeee" align="center"><a href="cd_writing.asp?opid=ApproveCancel&Frmid=<%= DispRs(0) %>"><%= DispRs(0) %></a></td>
<td bgcolor="#eeeeee" align="center"><%= datepart("d",DispRs(1)) & "/" & datepart("m",DispRs(1)) & "/" & datepart("YYYY",DispRs(1)) & " " & FormatDateTime(DispRs(1),4)%></td>
<%
Dim GetName
GetName=Conn.Execute("Select Emp_Name from Employeedetails where Employee_id=" & DispRs(2))
%>
<td bgcolor="#eeeeee" align="center"><%= GetName(0) %></td>
<%
Dim ProjName
ProjName=Conn.Execute("Select Pj_name from ProjectProfile where Pj_id=" & DispRs(3))
if ProjName(0)="" then
GetProjName="Others"
else
GetProjName=ProjName(0)
end if
%>
<td bgcolor="#eeeeee" align="center"><%= GetProjName %></td>
<td bgcolor="#eeeeee" align="center"><%= DispRs(4) %></td>
</tr>
<%
DispRs.MoveNext
wend %>
</table>
<br><br>
<table ID="Table5">
<tr>
<td><a href="cd_writing.asp?opid=view"><img border=0 src="..\images\back.jpg"></a></td>
</tr>
</table>
<br>
<%
End If
%>
|
|

July 30th, 2008, 02:06 AM
|
|
Authorized User
|
|
Join Date: Jul 2008
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Also ASp mail is not triggered
ApprovMailObj.From=ApprovMailFrom
ApprovMailObj.To=ApprovMailIDs
ApprovMailObj.Subject="TIMS - CD request from "& ApprovEmpName & " | Approved"
ApprovMailObj.HtmlBody=ApprovMail
ApprovMailObj.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
ApprovMailObj.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mailserverip"
ApprovMailObj.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
ApprovMailObj.Configuration.Fields.Update
Response.Write (ApprovMailObj)
ApprovMailObj.Send
Kind suggestion is expected
|
|

July 30th, 2008, 02:12 AM
|
|
Authorized User
|
|
Join Date: Jul 2008
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The error shown in using while loop is
Error Type:
Active Server Pages, ASP 0113 (0x80004005)
The maximum amount of time for a script to execute was exceeded. You can change this limit by specifying a new value for the property Server.ScriptTimeout or by changing the value in the IIS administration tools.
|
|

July 30th, 2008, 01:40 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
There it is!!!
<%
While not DispRs.eof
DispRs.Movefirst
%>
Yes, you are doing MoveNext at the END of the loop...
But then every time through the loop, you reset the pointer BACK to the first record!!!
So you are never never never moving away from the first record!
An infinite loop.
GET RID of that MoveFirst!!!
|
|

July 31st, 2008, 01:11 AM
|
|
Authorized User
|
|
Join Date: Jul 2008
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you very much pedant.
Can you give me some ideas regarding that Asp mail issue
|
|

July 31st, 2008, 01:41 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
|
|
If that mail code is the *actual* code you are trying to use, then unless "mailservip" is some magic name in your system, you are just using somebody's *EXAMPLE*. You're supposed to use the IP address (or name) of your *own* server.
I also see you doing
Response.Write (ApprovMailObj)
which can't possibly be doing anything useful.
Just saying something "doesn't work" isn't very helpful. You need to say *HOW* it doesn't work. You need to say what debugging you have done.
|
|

July 31st, 2008, 10:04 PM
|
|
Authorized User
|
|
Join Date: Jul 2008
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
No. I have provided the mailserverip address in my code. I just said an example. The response.write thing is just to print the output with content and nothing to do with the process.
The problem is
When i send a mail using the above code only(providing the mail server ) it works. But if add some process using loops to fetch mail id from db and doing the same, I got the confirmation that the mail is send. But I was not able receive the mail.
For example I used response.write("send") at the end of the code to confirm the mail is send or not.
Also I also want to is there any debugging mechanism exist in ASP as in .Net to debug the code line by line.
Thanking you for your continual support
|
|
 |