Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
ASP Ping results to database
Old 09-01-2006, 10:52 AM ASP Ping results to database
Novice Talker

Posts: 10
Trades: 0
Hi.

I am trying to develop an asp page that will ping a server (say google.com) from my home server, and than save the results to a database. We have been having internet troubles lately, and I want it to automatically ping google every (say 25 minutes) and then record the results to a database.

So far I have:

Code:
 
<% Response.Buffer = true %> 
<% 
    url = "Google" 
 
    Set objWShell = CreateObject("WScript.Shell") 
    Set objCmd = objWShell.Exec("ping " & url) 
    strPResult = objCmd.StdOut.Readall() 
    set objCmd = nothing: Set objWShell = nothing 
 
    strStatus = "offline" 
    if InStr(strPResult,"TTL=")>0 then strStatus = "online" 
 
    response.write url & " is " & strStatus 
    response.write ".<br>" & replace(strPResult,vbCrLf,"<br>") 
%>
This will post the results on screen, but I would like these to go to a my connected MS Access database.

Any suggestions
Thanks

Last edited by kw91; 09-01-2006 at 10:54 AM..
kw91 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-01-2006, 11:46 PM Re: ASP Ping results to database
ExpressoDan's Avatar
Ultra Talker

Posts: 317
Name: This Space for Rent
Location: Georgia
Trades: 0
Here is a simple insert script you can customize to fit your needs. Replace with your variable names.

Code:
<%
dim sSQL, sConnString
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _ 
"Data Source=" & Server.MapPath("your_database_name.mdb") 
Set connection = Server.CreateObject("ADODB.Connection")
sSQL="INSERT INTO tablename (fieldname1, fieldname2) VALUES ('value to enter into fieldname1', 'value to enter into fieldname2')" 
connection.Open(sConnString)
connection.execute(sSQL)
Connection.Close
Set Connection = Nothing
%>
__________________

Please login or register to view this content. Registration is FREE

"I think therefore I am, I think." <!-- George Carlin
ExpressoDan is offline
Reply With Quote
View Public Profile Visit ExpressoDan's homepage!
 
Reply     « Reply to ASP Ping results to database
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.45963 seconds with 12 queries