Wrox Home  
Search P2P Archive for: Go

  Return to Index  

interdev_programming thread: Refresh or Timer????


Message #1 by "wangzongyuan" <wangzongyuan@h...> on Thu, 24 May 2001 10:01:26
hi,jeff:
thanks for your answer. you are right.
1. I used VB to program a web browser and just set time interval to half a 
second.then run that program even in the local computer, my god, the web 
page is keep refreshing. although I can see all the up-to-date data,but 
such a dynamic web page is not good to my eyes. It's absolutely not a good 
solution.
2. then I set a timer in a HTML file. the codes looks like that:
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE>test</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="VBSCRIPT">
'open remote database once on the network
dim cn
dim rs
set cn=createobject("adodb.connection")
cn.ConnectionString="provider=sqloledb;database=wangzongyuan;server=IPaddre
ss;uid=wang;pwd=12344"
cn.Open 

'open recordset and display data every half a second
sub ietimer1_timer()
set rs=createobject("adodb.recordset")

ietimer1.Interval =500
rs.Open "select * from tablename",cn 

		text1.value =rs.Fields ("speed")
		text2.value =rs.Fields ("torque")
		text3.value =rs.Fields ("thrust")
 End Sub
   </SCRIPT></body></html>
I believe this the client-side script and when runing this file, remote 
database on remote server is connected,all up-to-date data are displayed 
in client computer's web browser.but also there's a problem, when 
clicking "view", then "source", you can see everything including server ip 
address,database name and even password. I feel very worried because my 
database could be easily hacked by someone.
3. then I changed my idea and want to write a serve side script such as 
ASP.I successfully created a ASP file, when opening it,all data displayed. 
when clicking Refresh, then all data changed.
but I don't want to always click "Refresh" button,everything should be 
automatic.so I think I should put a timer control into a ASP file.when 
opening that ASP file once, that file should automatically send up-to-date 
data to the client computer's web browser.do you know how to insert a 
timer control into a ASP file (not HTML file)? could you show me some 
example codes?
thanks again.
have a good day.


  Return to Index