下面是一個類中的事件。
Public Sub Insert(ByVal strSql As String)
Try
Comm.CommandText = strSql
Comm.ExecuteNonQuery()
'----------------------------------下句有問題
Response.Write("<script>alert('成功');<script>")
Catch ex As Exception
Response.Write("<script>alert('失敗');<script>")
End Try End Sub
Public Sub Insert(ByVal strSql As String)
Try
Comm.CommandText = strSql
Comm.ExecuteNonQuery()
'----------------------------------下句有問題
Response.Write("<script>alert('成功');<script>")
Catch ex As Exception
Response.Write("<script>alert('失敗');<script>")
End Try End Sub
-----------------------
Response is not available in this context.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Try
Comm.CommandText = strSql
Comm.ExecuteNonQuery()
'----------------------------------下句有問題
page.Response.Write("<script>alert('成功');<script>")
Catch ex As Exception
page.Response.Write("<script>alert('失敗');<script>")
End Try End Sub调用的时候Insert(sql,this.page)