Ejemplo n.º 1
0
        /// <summary>
        /// Retrieves the values of the record
        /// </summary>
        /// <param name="strSQL">The SQL query to find the record to load</param>
        /// <param name="dbConn">The connection to the MS SQL database to use</param>
        protected void GetRecordValues(string strSQL, DatabaseConn dbConn)
        {
            if (dbConn == null)
            {
                throw new Exception("Unable to submit query, no database connection was provided.");
            }

            try {
                dbConn.SelectQueryOneRecord(strSQL, this);
            } catch (Exception exErr) {             //Fill with blank values and rethrow error
                GenerateEmptyRecord();

                //Ignore exceptions from no records returned
                if (exErr.Message.StartsWith("The SQL query given retrned 0 rows") == false)
                {
                    throw new Exception("Error executing SQL statement: " + strSQL + "\n" + exErr.Message);
                }
            }
        }
Ejemplo n.º 2
0
		/// <summary>
		/// Retrieves the values of the record
		/// </summary>
		/// <param name="strSQL">The SQL query to find the record to load</param>
		/// <param name="dbConn">The connection to the MS SQL database to use</param>
		protected void GetRecordValues(string strSQL, DatabaseConn dbConn) {
			if (dbConn == null) {
				throw new Exception("Unable to submit query, no database connection was provided.");
			}

			try {
				dbConn.SelectQueryOneRecord(strSQL, this);
			} catch (Exception exErr) { //Fill with blank values and rethrow error
				GenerateEmptyRecord();

				//Ignore exceptions from no records returned
				if (exErr.Message.StartsWith("The SQL query given retrned 0 rows") == false) {
					throw new Exception("Error executing SQL statement: " + strSQL + "\n" + exErr.Message);
				}
			}
		}
Ejemplo n.º 3
0
 /// <summary>
 /// Constructor to prepare the class
 /// </summary>
 /// <param name="dbConn">Database connection object for this class to use</param>
 public DBRecord(DatabaseConn dbConn)
     : base()
 {
     cdbConn  = dbConn;
     Disposed = false;
 }
Ejemplo n.º 4
0
		/// <summary>
		/// Constructor to prepare the class
		/// </summary>
		/// <param name="dbConn">Database connection object for this class to use</param>
		public DBRecord(DatabaseConn dbConn)
			: base() {
			cdbConn = dbConn;
			Disposed = false;
		}