在VB.NET中调用自定义SQL Server存储过程和URL重定向
我正在构建一个aspx web应用程序。我的应用程序中有一个“提交”按钮,可以调用自定义存储过程。我试图找出在执行存储过程后重定向用户的代码 下面是我的按钮+存储过程的VB.NET代码:在VB.NET中调用自定义SQL Server存储过程和URL重定向,sql,asp.net,sql-server,vb.net,stored-procedures,Sql,Asp.net,Sql Server,Vb.net,Stored Procedures,我正在构建一个aspx web应用程序。我的应用程序中有一个“提交”按钮,可以调用自定义存储过程。我试图找出在执行存储过程后重定向用户的代码 下面是我的按钮+存储过程的VB.NET代码: Public Overrides Sub SubmitRequisition1_Click(ByVal sender As Object, ByVal args As EventArgs) Try Dim CatalogID as Integer CatalogID = Ctype(me.C
Public Overrides Sub SubmitRequisition1_Click(ByVal sender As Object, ByVal args As EventArgs)
Try
Dim CatalogID as Integer
CatalogID = Ctype(me.CatalogID.text, int32)
DbUtils.StartTransaction()
Dim spName As BaseClasses.Data.StoredProcedure = Nothing
Dim firstParameter as BaseClasses.Data.StoredProcedureParameter = Nothing
firstParameter = New BaseClasses.Data.StoredProcedureParameter("@p_CatalogID", CatalogID, System.Data.SqlDbType.Int, System.Data.ParameterDirection.Input)
Dim parameterList(0) As BaseClasses.Data.StoredProcedureParameter
parameterList(0) = firstParameter
spName = New StoredProcedure("DatabaseStoktrak1", "dbo.pHSEProcessWardReqsParams", parameterList)
spName.RunNonQuery()
DbUtils.CommitTransaction()
Catch ex As Exception
' Report the error message to the end user'
BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(Me, "BUTTON_CLICK_MESSAGE", ex.Message)
DbUtils.RollBackTransaction()
Finally
DbUtils.EndTransaction()
End Try
End Sub
当我插入这行代码时
Response.Redirect("../LocationCatalog/WARDEditLocationCatalog.aspx")
我得到一个编译器错误
编译器错误消息:BC30451:未声明名称“Response”
这行代码正确吗?如果正确,它需要去哪里?我需要申报什么东西吗
非常感谢您的帮助
在这方面,Tomas只是出于兴趣使用了
HttpContext.Current.Response.Redirect(“../LocationCatalog/WARDEditLocationCatalog.aspx”)
我在以前的ASP Web应用程序中遇到了这个问题,这个问题得到了解决
编辑
如果没有,那么我相信您可能需要在VB代码页的顶部声明这一点
Imports System.Web
我可以确认添加这行代码:HttpContext.Current.Response.Redirect(“../LocationCatalog/WARDEditLocationCatalog.aspx”)对我有效。另外,在我的页面顶部,我声明Imports System.Web.UI Imports System.Web.UI.WebControls