响应重定向帮助 [英] response redirect help
问题描述
你好我试图使用响应重定向语句在从数据库中删除记录时显示消息
。我的数据库是通过
页面运行的,页面旁边有一个带删除选项的表。当单击删除
链接时,脚本会加载一个页面,其中包含一个立即的
response.redirect。这是delete_response
页面的代码。
<%Option明确%>
<! - #include virtual =" \06Winter / levini / database / adovbs.inc" - >
<! - #include file =" DatabaseConnect2.asp" - >
< HTML>
< center>
<%Dim objRS,bolFound,CustID,intCustID
CustID = Request.querystring(" CustID")
intCustID = CInt(request(" CustID"))
设置objRS = Server.CreateObject(" ADODB.Recordset")
objRS.Open" tblCustomerData",objConn,adOpenForwardOnly,
adLockOptimistic,adCmdTable
bolFound = False
''在表中查找CustID
请勿(objRS.EOF或bolFound)
如果( StrComp(objRS(" CustID"),CustID,vbTextCompare)= 0)然后
BolFound = True
否则
objRS.MoveNext
结束如果
循环
objRS.Delete
objRS.Close
设置objRS = Nothing
objConn 。关闭
设置objConn = Nothing
response.redirect" ListCustomers.asp?StatusMessage = Customer ID"
&请求(CustID)& "已成功删除。
%>
< / BODY>
< / HTML>
我想要做的是在我的主页上放一条消息,显示来自response.redirect提示符的
消息。如何创建消息
从阅读查询字符串
thanx获取帮助
isaac
Issac,
只是一个想法,这是一个简单的方法,您可能想要添加变量,例如:
response.redirect" ListCustomers.asp?StatusMessage = Customer ID" &
请求(CustID)& "& delcust = 1"
然后在显示客户的页面上你可以放一个简单的
一点响应。只有激活才能激活变量delcust =
1.例子
<%
Dim DelCust
DelCust = 0
DelCust = Request.QueryString(" delcust")
如果DelCust = 1那么
Response.Write" Customer Deleted"
Else
我过去使用的东西非常简单。
现在,如果你想做一个警告框,这是另一个故事
isaac2004写道:你好我试图使用响应重定向语句来显示一条消息
从数据库中删除记录。我的数据库是通过
页面运行的,页面旁边有一个带删除选项的表。当单击删除
链接时,脚本会加载一个页面,其中包含一个
response.redirect。这是delete_response
页面的代码。
<%Option Explicit%>
<! - #include virtual =" \06Winter / levini / database / adovbs.inc" - >
<! - #include file =" DatabaseConnect2.asp" - >
< HTML>
< center>
<%Dim objRS,bolFound,CustID,intCustID
CustID = Request.querystring(" CustID")
intCustID = CInt(request(" CustID") ;))
设置objRS = Server.CreateObject(" ADODB.Recordset")
objRS.Open" tblCustomerData",objConn,adOpenForwardOnly,
adLockOptimistic,adCmdTable
bolFound = False
''在表中查找CustID
Do While Not(objRS.EOF OR bolFound)
If(StrComp(objRS(" CustID)), CustID,vbTextCompare)= 0)然后
BolFound = True
其他
objRS.MoveNext
结束如果
循环
objRS.Delete
objRS.Close
设置objRS = Nothing
objConn.Close
设置objConn = Nothing
response.redirect" ListCustomers.asp ?StatusMessage =客户ID
&请求(CustID)& "已成功删除。
%>
< / BODY>
< / HTML>
我想做的是放一个我的主页上显示来自response.redirect提示的
消息的消息。我如何通过阅读查询字符串来创建消息
用于帮助
isaac
嘿thanx的帮助,但是没有正常工作,在我的代码中
我会把脚本用于消息
观看Word Wrap!
你的ListCustomers.asp页面的一部分会有所帮助,但是
这里是最佳案例场景。
您在delete_response页面中的重定向行。我总是发现最好
从webroot输入页面的确切路径。
response.redirect" /ListCustomers.asp?StatusMessage =客户ID &
请求(CustID)& "& delcust = 1"
你的Listcustomers.asp页面,早期调用并设置查询字符串
脚本
Dim DelCust
DelCust = Request.QueryString(" delcust")
就在你打电话给你的循环以展示你的顾客之前:
如果DelCust = 1那么
response.write" Customer Removed"
结束如果
>
hello i am trying to use a response redirect statment to show a message
upon deletion of a record from a database. my database is ran though a
page with a table with a delete option on the side. when the delete
link is clicked, the script loads a page that has a immediate
response.redirect in it. here is that code for the delete_response
page.
<% Option Explicit %>
<!--#include virtual="\06Winter/levini/database/adovbs.inc"-->
<!--#include file="DatabaseConnect2.asp"-->
<HTML>
<center>
<% Dim objRS, bolFound, CustID, intCustID
CustID = Request.querystring("CustID")
intCustID = CInt(request("CustID"))
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "tblCustomerData", objConn, adOpenForwardOnly,
adLockOptimistic, adCmdTable
bolFound = False
''look for CustID in table
Do While Not (objRS.EOF OR bolFound)
If (StrComp(objRS("CustID"), CustID, vbTextCompare) = 0) Then
BolFound = True
Else
objRS.MoveNext
End If
Loop
objRS.Delete
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
response.redirect "ListCustomers.asp?StatusMessage=Customer ID "
& request("CustID") & " successfully deleted."
%>
</BODY>
</HTML>
what i want to do is put a message on my mainpage that displays the
message from the response.redirect prompt. how do i create a message
from reading the querystring
thanx for the help
isaac
Issac,
Just a thought and this is an easy way of doing this, in your
querystring you may want to add a varialbe such as:
response.redirect "ListCustomers.asp?StatusMessage=Customer ID " &
request("CustID") & "&delcust=1"
Then on your page that displays the customers you can put a simple
little response.write that is only activated if the variable delcust =
1. Example
<%
Dim DelCust
DelCust = 0
DelCust = Request.QueryString("delcust")
If DelCust = 1 Then
Response.Write "Customer Deleted"
Else
Just something that I have used in the past that works very easy.
Now if you want to do an alert box that is another story
isaac2004 wrote:hello i am trying to use a response redirect statment to show a message
upon deletion of a record from a database. my database is ran though a
page with a table with a delete option on the side. when the delete
link is clicked, the script loads a page that has a immediate
response.redirect in it. here is that code for the delete_response
page.
<% Option Explicit %>
<!--#include virtual="\06Winter/levini/database/adovbs.inc"-->
<!--#include file="DatabaseConnect2.asp"-->
<HTML>
<center>
<% Dim objRS, bolFound, CustID, intCustID
CustID = Request.querystring("CustID")
intCustID = CInt(request("CustID"))
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "tblCustomerData", objConn, adOpenForwardOnly,
adLockOptimistic, adCmdTable
bolFound = False
''look for CustID in table
Do While Not (objRS.EOF OR bolFound)
If (StrComp(objRS("CustID"), CustID, vbTextCompare) = 0) Then
BolFound = True
Else
objRS.MoveNext
End If
Loop
objRS.Delete
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
response.redirect "ListCustomers.asp?StatusMessage=Customer ID "
& request("CustID") & " successfully deleted."
%>
</BODY>
</HTML>
what i want to do is put a message on my mainpage that displays the
message from the response.redirect prompt. how do i create a message
from reading the querystring
thanx for the help
isaac
hey thanx for the help but that isnt working properly, where in my code
would i put the script for the mesage
Watch For Word Wrap!
Well a portion of your ListCustomers.asp page would be helpful, however
here is the best case scenario.
Your redirect line in delete_response page. I have always found it best
to enter in the exact path of the page from the webroot.
response.redirect "/ListCustomers.asp?StatusMessage=Customer ID " &
request("CustID") & "&delcust=1"
Your Listcustomers.asp page, Call and set the querystring early on in
the script
Dim DelCust
DelCust = Request.QueryString("delcust")
Just before you call your loop to display your customers:
If DelCust = 1 Then
response.write "Customer Removed"
End If
这篇关于响应重定向帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!