Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp script - check link status then update db

Status
Not open for further replies.

Stefanm

MIS
Jun 4, 2003
1
NL
Hi, everyone,

I'm trying to update an Access db: if link is ok, then status=up else status=down, in a form with 3 fields: sitename, link, status:


<%
Server.ScriptTimeout = 150

Set db = Server.CreateObject(&quot;ADODB.Connection&quot;)
db.Open &quot;Provider=Microsoft.Jet.OLEDB.4.0; Data Source=&quot; & Server.MapPath(&quot;/press/baza/data.mdb&quot;) & &quot;;&quot;
set rs=Server.CreateObject(&quot;ADODB.Recordset&quot;)

mySQL = &quot;SELECT * FROM ziare ORDER BY ziar ASC&quot;
rs.open mySQL, db, 1, 1
rs.MoveFirst
Do Until rs.EOF
SiteName = rs(&quot;name&quot;)
GotothisURL = rs(&quot;link&quot;)
Set GetConnection = CreateObject(&quot;Microsoft.XMLHTTP&quot;)
GetConnection.Open &quot;get&quot;, GotothisURL, False
on error resume next
GetConnection.Send
ResponsePage = GetConnection.responseText

if ResponsePage=&quot;&quot; then
sql = &quot;INSERT INTO sites (status) VALUES ('down') WHERE SiteName = rs(&quot;name&quot;)&quot;
else
sql = &quot;INSERT INTO sites (status) VALUES ('up') WHERE SiteName = rs(&quot;name&quot;)&quot;

db.Execute(sql)
UPDATE sites

Set GetConnection = Nothing
Set ResponsePage = Nothing

rs.MoveNext
Loop

rs.close
set rs = nothing

%>

What is wrong??
Please help,

Thank you
 
What error are you receiving?

It looks to me like you need to add to your SQL....

sql = &quot;INSERT INTO sites (status) VALUES ('down') WHERE SiteName = '&quot;&rs(&quot;name&quot;)&&quot;'&quot;

....But I've been wrong before
ClassyLinks :cool:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top