webForumDet fria alternativet

Problem med script som "krockar"

ASPur ASP

0 svar · 151 visningar · startad av Korak

KorakMedlem sedan maj 2001133 inlägg
#1

Hur ska jag göra för att få in ett till likadant script som nedanför, på samma sida, men som istället länkar till updates.asp och updates.mdb Alltså både "news" och "updates" på samma sida. Jag har försökt men det blir bara fel. Antar att jag måste "skala av" det andra scriptet på något sätt så att det inte blir dubbla frågor mm. Jag får helt enkelt inte till det.

<!-- #INCLUDE FILE="adovbs.inc" -->
<html>
<head>
</head>
<body>

<%

CONN_STRING = "DBQ=" & Server.MapPath("news.mdb") & ";"
CONN_STRING = CONN_STRING & "Driver={Microsoft Access Driver (*.mdb)};"
''buil string for connection my database file is link.mdb in store in the same folder of this file.

Dim iPageSize
Dim iPageCount
Dim iPageCurrent
Dim strOrderBy
Dim strSQL
Dim objPagingConn
Dim objPagingRS
Dim iRecordsShown
Dim I

iPageSize = 1
''set page size

If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else
iPageCurrent = CInt(Request.QueryString("page"))
End If

If Request.QueryString("order") = "" Then
strOrderBy = "id"
Else
strOrderBy = Request.QueryString("order")
End If

strSQL = "select * from message order by ID desc;"

'' select sql from the table..my table in news.mdb name "message"

Set objPagingConn = Server.CreateObject("ADODB.Connection")
objPagingConn.Open CONN_STRING
''open connection

Set objPagingRS = Server.CreateObject("ADODB.Recordset")
objPagingRS.PageSize = iPageSize
objPagingRS.CacheSize = iPageSize
objPagingRS.Open strSQL, objPagingConn, adOpenStatic, adLockReadOnly, adCmdText

reccount = objPagingRS.recordcount
iPageCount = objPagingRS.PageCount

If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
If iPageCurrent < 1 Then iPageCurrent = 1

If iPageCount = 0 Then
Response.Write "<center><font color=red size=3>No records found!</font></center>"
Else
objPagingRS.AbsolutePage = iPageCurrent

%> <%
iRecordsShown = 0
Do While iRecordsShown < iPageSize And Not objPagingRS.EOF
dagar=DateDiff("d", Date, objPagingRS("PostDate"))+2
if dagar >= 0 then
%> <%=objPagingRS("Postdate")%><br>
<a href="news.asp?id=<%=objPagingRS("ID")%>&mode=read2" target="mainFrame"><%=objPagingRS("Subject")%></a>
<%else%> <font color="#999999"><%=objPagingRS("Postdate")%></font><br>
<a href="news.asp?id=<%=objPagingRS("ID")%>&mode=read2" target="mainFrame"><%=objPagingRS("Subject")%></a>
<%
end if
iRecordsShown = iRecordsShown + 1
objPagingRS.MoveNext
Loop
%> <%
End If

objPagingRS.Close
Set objPagingRS = Nothing
objPagingConn.Close
Set objPagingConn = Nothing

If iPageCurrent <> 1 Then
%> <%
End If
%>

</body>
</html>

Tack på förhand!
//Korak

------------------

MVH, Korak
www.eskobar.nu

131 ms totalt · 3 externa anrop · v20260731065814-full.29ac60f6
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
128 ms — hämta tråd, inlägg och bilagor (db)