我试图从请求页面的查询字符串中获取参数“id”,如下所示
If Request.QueryString IsNot Nothing AndAlso _
Request.QueryString.GetKey("id") IsNot Nothing Then
DeleteVehicle(Request.QueryString.GetKey("id"))
End If
但我得到这个错误
System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 16: If Request.QueryString IsNot Nothing AndAlso _
Line 17: Request.QueryString.GetKey("id") IsNot Nothing Then
Source File: G:\projects_backup\Toaab\Toaa\admin\vehicle\view.aspx.vb Line: 16
请你帮帮我
编辑
我在 page_load 事件中调用它
通过超链接调用同一页面(具有自动生成的链接)
我也将代码更改为
If Request.QueryString("id") IsNot Nothing OrElse Request.QueryString("id") IsNot String.Empty Then
DeleteVehicle(Request.QueryString("id").ToString)
End If