HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 21st, 2004, 08:58 AM
davidcat davidcat is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 21 davidcat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
refresh database results on webpage

Hi i'm having problems, i have a access db and a webpage. I can connect to the db and display the results on the webpage, but i want to have a refresh button the the page to check if the db has changed at all.

Right this is the code ive now got in the html to display the records:

<% response.write (Outdoor) %>
<% response.write (Indoor) %>

Indoor and Outdoor are called from an included file whose code is:




<%

Set MyConn = Server.CreateObject("ADODB.Connection")
MdbFilePath = Server.MapPath("TemperatureDB.mdb")
MyConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";"
SQL_query = "SELECT * FROM MyTable"
Set RS = MyConn.Execute(SQL_query)
WHILE NOT RS.EOF




%>
<%Outdoor = RS("Outdoor") %>

<%Indoor = RS("Indoor") %>


<%


RS.MoveNext
WEND

MyConn.close

%>

And the code to refresh these records on the webpage is:

<form name="form1" method="post" action="">
<input type="button" name="Submit" value="Submit" onClick="<%=RS("Outdoor")%>">
</form>

Im getting this error message on the webpage:

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'RS'

/controlpanel.asp, line 80



Any help would be grateful

cheers david catley

Reply With Quote
  #2  
Old March 23rd, 2004, 01:17 PM
sprak sprak is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 6 sprak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Before you say Set RS = MyConn.Execute(SQL_query),
you need to create the recordset object this way
Set RS = Server.CreateObject("ADODB.Recordset")
and then execute your sql query
Set RS = MyConn.Execute(SQL_query.
Quote:
Originally Posted by davidcat
Hi i'm having problems, i have a access db and a webpage. I can connect to the db and display the results on the webpage, but i want to have a refresh button the the page to check if the db has changed at all.

Right this is the code ive now got in the html to display the records:

<% response.write (Outdoor) %>
<% response.write (Indoor) %>

Indoor and Outdoor are called from an included file whose code is:




<%

Set MyConn = Server.CreateObject("ADODB.Connection")
MdbFilePath = Server.MapPath("TemperatureDB.mdb")
MyConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";"
SQL_query = "SELECT * FROM MyTable"
Set RS = MyConn.Execute(SQL_query)
WHILE NOT RS.EOF




%>
<%Outdoor = RS("Outdoor") %>

<%Indoor = RS("Indoor") %>


<%


RS.MoveNext
WEND

MyConn.close

%>

And the code to refresh these records on the webpage is:

<form name="form1" method="post" action="">
<input type="button" name="Submit" value="Submit" onClick="<%=RS("Outdoor")%>">
</form>

Im getting this error message on the webpage:

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'RS'

/controlpanel.asp, line 80



Any help would be grateful

cheers david catley

Reply With Quote
  #3  
Old June 15th, 2004, 10:59 AM
sanjanah_verma sanjanah_verma is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 190 sanjanah_verma User rank is Corporal (100 - 500 Reputation Level)sanjanah_verma User rank is Corporal (100 - 500 Reputation Level)sanjanah_verma User rank is Corporal (100 - 500 Reputation Level)sanjanah_verma User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 7 h 16 m 13 sec
Reputation Power: 6
You want the contents that are displayed in the webpage from the Database to show you the details of the latest update made to the database.Is that correct?If that is the case you can simply include this code

<meta http-equiv="Refresh" content="10">

in the head section of the script.This will refresh the contents of the page every 10 seconds(you can set your own refreshing time interval).Your program may be written like this:

<html>
<head>
<meta http-equiv="Refresh" content="10">
</head>
<%

Set MyConn = Server.CreateObject("ADODB.Connection")
MdbFilePath = Server.MapPath("TemperatureDB.mdb")
MyConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";"
SQL_query = "SELECT * FROM MyTable"
Set RS = MyConn.Execute(SQL_query)
WHILE NOT RS.EOF





RS.MoveNext
WEND

MyConn.close

%>

And the code to refresh these records on the webpage is:

<form name="form1" method="post" action="">
<input type="button" name="Submit" value="Submit" onClick="<%=RS("Outdoor")%>">
</form>
</html>

Hope this helps you.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > refresh database results on webpage


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway