Server Error in '/' Application. Object reference not set to an instance of an object. 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.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 844: Dim dt As New DataTable
Line 845:
Line 846: format_type_id = Request.QueryString("ID").ToString.Trim
Line 847:
Line 848: 'take the value from db so easy to maintain the format name
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Doccon.ESER_Doc_Form.get_format_type() in C:\Users\naquid9065\Documents\Q SMTT\Doccon\Doccon\ESER-Doc-Form.aspx.vb:846
Doccon.ESER_Doc_Form.Page_Load(Object sender, EventArgs e) in C:\Users\naquid9065\Documents\Q SMTT\Doccon\Doccon\ESER-Doc-Form.aspx.vb:57
System.Web.UI.Control.OnLoad(EventArgs e) +95
System.Web.UI.Control.LoadRecursive() +59
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678
Code:
Private Sub get_format_type()
Dim strSQL As String = ""
Dim params As New Hashtable
Dim dt As New DataTable
format_type_id = Request.QueryString("ID").ToString.Trim (error from here)
strSQL = "SELECT * FROM tb_setup_format_type WHERE status ='1' and ID = @ID "
params.Add("@ID", format_type_id)
Common.OpenConn()
Common.execReader(strSQL, params, dt, Common.txn)
If dt.Rows.Count <> 0 Then
Me.txtformat.Text = dt.Rows(0)("Report_Format").ToString.Trim
End If
Common.CloseConn()
End Sub