
Dreamweaver中使用Vbscript语言,关于记录集使用的种种问题
各位大侠好,我是菜鸟一只,这两天刚接触Dreamweaver和VB我现在在做一个动态网页我现在纠结于对某数据库查询操作的出错处理问题test.asp是查询信息输入页面te...
各位大侠好,我是菜鸟一只,这两天刚接触Dreamweaver和VB
我现在在做一个动态网页
我现在纠结于对某数据库查询操作的出错处理问题
test.asp是查询信息输入页面
test2.asp是结果显示页面
Recordset1是test2.asp绑定的记录集
该记录集是对表Book的查询
具体的语言如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include virtual="/Connections/eBUY_Link.asp" -->
<%
Dim Recordset1__mmm
Recordset1__mmm = "001"
If (Request.QueryString("textfield") <> "") Then
Recordset1__mmm = Request.QueryString("textfield")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.Source = "SELECT * FROM dbo.Book WHERE dbo.Book.Bno=" + Replace(Recordset1__mmm, "'", "''") + ""
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%=(Recordset1.Fields.Item("Bno").Value)%>
<%=(Recordset1.Fields.Item("Bname").Value)%>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
这个代码我基本能懂一些,我的问题是如何进行出错处理
比如说我现在Book表里面只有2个记录
编号分别是001和002
编号Bno是通过变量Recordset1来赋值的
但是如果输入了错误的数据,我想使页面报错,并且返回查询页面
那么我该怎么样弄?
注:使页面报错不是什么系统错误啊,绝对不是该页面不存在等等之内的。而是我设置的规定的出错显示!
小弟跪谢了!先悬赏50分!受益后再追加50! 展开
我现在在做一个动态网页
我现在纠结于对某数据库查询操作的出错处理问题
test.asp是查询信息输入页面
test2.asp是结果显示页面
Recordset1是test2.asp绑定的记录集
该记录集是对表Book的查询
具体的语言如下:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include virtual="/Connections/eBUY_Link.asp" -->
<%
Dim Recordset1__mmm
Recordset1__mmm = "001"
If (Request.QueryString("textfield") <> "") Then
Recordset1__mmm = Request.QueryString("textfield")
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows
Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.Source = "SELECT * FROM dbo.Book WHERE dbo.Book.Bno=" + Replace(Recordset1__mmm, "'", "''") + ""
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()
Recordset1_numRows = 0
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%=(Recordset1.Fields.Item("Bno").Value)%>
<%=(Recordset1.Fields.Item("Bname").Value)%>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
这个代码我基本能懂一些,我的问题是如何进行出错处理
比如说我现在Book表里面只有2个记录
编号分别是001和002
编号Bno是通过变量Recordset1来赋值的
但是如果输入了错误的数据,我想使页面报错,并且返回查询页面
那么我该怎么样弄?
注:使页面报错不是什么系统错误啊,绝对不是该页面不存在等等之内的。而是我设置的规定的出错显示!
小弟跪谢了!先悬赏50分!受益后再追加50! 展开
1个回答
展开全部
你说的很复杂 是不是做一个查询页面和一个现实页面呢?
如果是的话 那么可能是你记录集有问题咯
后面的显示页面的记录集要选择的 在建记录集的最下面有
比方说你要输入名字就可以查到数据库里面的数据显示在显示的页面
那么在你的第2页建立记录集的时候要选择
name= 表单变量 nama吧
大概就是这样的 差不多 你试试就知道了
希望你 的w问题可以解决。
不明白 的地方hi百度我下 一起研究
如果是的话 那么可能是你记录集有问题咯
后面的显示页面的记录集要选择的 在建记录集的最下面有
比方说你要输入名字就可以查到数据库里面的数据显示在显示的页面
那么在你的第2页建立记录集的时候要选择
name= 表单变量 nama吧
大概就是这样的 差不多 你试试就知道了
希望你 的w问题可以解决。
不明白 的地方hi百度我下 一起研究
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询