I am trying to get the result of sql query in an int variable, but I am getting object null reference error. Can someone guide me please.
oconn = new SqlConnection(oSession.CONNECTION_STRING);
oconn.Open();
objCmd.CommandText = "select Rule_Approval_Selection from UserFile where uid=" + intUserID;
int value = (Int32)(objCmd.ExecuteScalar());
oconn.Close();