📄 catchexception.aspx
字号:
<%@ Import Namespace="System.Data.SqlClient" %>
<Script Runat="Server">
Sub Page_Load
Dim conNorthwind As SqlConnection
Dim cmdSelect As SqlCommand
conNorthwind = New SqlConnection( "Server=localhost;UID=sa;pwd=secret;Database=Northwind;Connection Timeout=15" )
cmdSelect = New SqlCommand( "select * from Products", conNorthwind )
Try
conNorthwind.Open
dgrdProducts.DataSource = cmdSelect.ExecuteReader
dgrdProducts.DataBind()
conNorthwind.Close
Catch objException As Exception
Response.Write( "We're sorry, we are experiencing technical problems..." )
Response.Write( "<hr>" )
Response.Write( "<li> Message: " & objException.Message )
Response.Write( "<li> Source: " & objException.Source )
Response.Write( "<li> Stack Trace: " & objException.StackTrace )
Response.Write( "<li> Target Site: " & objException.TargetSite.Name )
End Try
End Sub
</Script>
<html>
<head><title>CatchException.aspx</title></head>
<body>
<asp:DataGrid
ID="dgrdProducts"
Runat="Server" />
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -