Forum Moderators: open

Message Too Old, No Replies

I got Timeout expired from SQL Server

         

justify

7:45 am on May 15, 2003 (gmt 0)

10+ Year Member



Hi, My database has about 800.000 records which I use SQL Server 2000. When i try to take records from database, I got like below the error. How can I solve this problem?
I wonder my ISS has problem? thanks for now your helping

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E31)
[Microsoft][ODBC SQL Server Driver]Timeout expired
/anews/5.asp, line 19

My codes are
<%
Server.ScriptTimeOut = 320
%>
<!--#include file="connection.asp"-->
<!--#include file="adovbs.inc"-->
<html>
<head>
<title>Untitled</title>
</head>
<body>

<%
Dim s
Dim rs,i
set rs = Server.CreateObject("ADODB.RecordSet")
SQL = "SELECT NEWS_ID,CITY,HEADLINE,DESCRIPTION FROM INT_NEWS_POOL ORDER BY NEWS_ID DESC"
rs.open SQL,Con
rs.pagesize = 5
rs.MaxRecords = 2000
for i=1 to rs.pagesize
If rs.eof Then exit for
%>
<table width="100%" border="0" cellspacing="2" cellpadding="4" align="center">
<tr>
<td width="25%" bordercolor="#FFFFFF" bordercolorlight="#FFFFFF" bordercolordark="#FFFFFF" border="0" cellspacing="2" cellpadding="0">
<div align="center"><a href="detay.asp?id=<%=rs("NEWS_ID")%>"></a></div>
</td>

<td width="65%" align="left"><strong><font size="2" face="Tahoma"><%= rs("CITY")%>&nbsp;&nbsp;
<%=rs("HEADLINE")%></font></strong><br><font face="Verdana" size="2">&nbsp;&nbsp;<%=rs("DESCRIPTION")%></font></td>

<td width=""><p><font face="Verdana" size="1" color="#808080"><%=rs("FILE_DATE")%><br>

<a href="detay.asp?id=<%=rs("NEWS_ID")%>"><font face="Verdana" size="2">metin</font></a>
</td>
</tr>
<hr>
</table>


<%
rs.MoveNext
Next
%>
</body>
</html>

Sinner_G

11:58 am on May 15, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sounds too easy, but have you tried changing your second line to something like

Server.ScriptTimeOut = 640

?

makeupalley

6:59 pm on May 18, 2003 (gmt 0)

10+ Year Member



actually, the timeout is in the database and not in the asp script. You should try and optimize your query.

Make sure you have where clauses :)

Elky

Miksu

9:18 am on May 20, 2003 (gmt 0)



I got excactly the same problem. I banged my head against the wall before I realized, that my database was missing primary keys.

Try adding primary keys to your table. It worked for me.

davegerard

1:09 am on May 23, 2003 (gmt 0)

10+ Year Member



Another thing you could try is to execute a stored proc in SQL rather than a select statement within your page.

makeupalley had a good point by narrowing down the criteria for your query.

Also, do you have any indexes on the table other than the primary key?

Dave