不刷新页面的情况下客户端访问服务器端的数据库,可以按照查询所得值,更新当前页面的显示内容吗?
谢紫枫 2004-11-23 09:39:52 想完成
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>控件测试</title>
</head>
<body>
<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" U-File="fpweb:///_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->
<p><select size="1" name="D1">
<option value=001>001</option>
<option value=002>002</option>
</select>
<input type="text" name="T1" size="20">
<input type="submit" value="提交" name="B1">
<input type="reset" value="重置" name="B2"></p>
</form>
</body>
</html>
<script language=vbscript>
sub D1_onchange
document.all.T1.Value=document.all.D1.Value*10
end sub
</script>
类似于这样的过程,就是改变下拉菜单中的内容,更新下拉菜单后面的文本框的内容
但是改变的数据想根据下拉菜单改变的数据去服务器端的数据库查询
应该怎样写?
<script language=vbscript runat =server>
sub T1_onchange
dim Cn
dim rs
dim strSQL
Cn=Server.CreateObject("ADODB.connection")
Cn.open "Provider=Sqloledb;Data Source=192.168.0.1;Network Library=DBMSSOCN;User Id=sa;Password=develop;Initial Catalog=DB;"
rs=Server.CreateObject("ADODB.recordset")
strSQL="select name from teble1 where no='"& document.all.D1.Value &"'"
rs.open strSQL,Cn,AdOpenDynamic
document.all.T1.Value=rs.Fields.Item("name").Value
end sub
</script>
我写的这个完全看不到有执行的迹象
请各位帮忙了
谢谢