|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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:
|
|
#3
|
|||
|
|||
|
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. |
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > refresh database results on webpage |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|