예제 #1
0
 /// <summary>
 /// Executes a scalar query with parameters and returns the value as type T or the defaultreturn value if there is an error in conversion.
 /// </summary>
 /// <typeparam name="T">The type of the value being returned.</typeparam>
 /// <param name="querytext">The query to run.</param>
 /// <param name="defaultreturn">The default value to return if there is an error converting the value.</param>
 /// <param name="paramlist">An SQLParamList object containing SqlParameters to pass into the SqlCommand object.</param>
 /// <returns>The scalar value of type T returned by the query.</returns>
 public T QueryScalarValue <T>(string querytext, T defaultreturn, SQLParamList paramlist)
 {
     return(QueryScalarValue <T>(querytext, defaultreturn, paramlist.ToArray()));
 }
예제 #2
0
 /// <summary>
 /// Will execute an insert query and return the identity value for the inserted row. Used to insert a row and retrieve the auto-generated identity value at the same time. On error, it returns the default value of T.
 /// </summary>
 /// <typeparam name="T">The type of the identity.</typeparam>
 /// <param name="querytext">An insert query.</param>
 /// <param name="paramlist">A SQLParamList object containing SqlParameters to pass into the SqlCommand object.</param>
 /// <returns>The identity value for the inserted row.</returns>
 public int QueryAndReturnIdentity(string querytext, SQLParamList paramlist)
 {
     return(QueryAndReturnIdentity(querytext, paramlist.ToArray()));
 }
예제 #3
0
 /// <summary>
 /// Executes a stored procedure.
 /// </summary>
 /// <param name="procedureName">The name of the stored procedure. Do not prepend "EXEC".</param>
 /// <param name="paramlist">An SQLParamList object containing SqlParameters to pass into the SqlCommand object.</param>
 /// <returns>A DataSet representing the returned dataset(s).</returns>
 public DataSet ExecStoredProcedureDataSet(string procedureName, SQLParamList paramlist)
 {
     return(ExecStoredProcedureDataSet(procedureName, paramlist.ToArray()));
 }
예제 #4
0
 /// <summary>
 /// Executes a query on the database with parameters.
 /// </summary>
 /// <param name="querytext">The text of the query.</param>
 /// <param name="paramlist">A SQLParamList object containing SqlParameters to pass into the SqlCommand object.</param>
 /// <returns>An object of type System.Data.DataTable containing the results of the queried data.</returns>
 public DataTable QueryDataTable(string querytext, SQLParamList paramlist)
 {
     return(QueryDataTable(querytext, paramlist.ToArray()));
 }
예제 #5
0
 /// <summary>
 /// Executes a non-query with parameters on the database connection specified in the constructor.
 /// </summary>
 /// <param name="querytext">The text of the query.</param>
 /// <param name="paramlist">An SQLParamList object containing SqlParameters to pass into the SqlCommand object.</param>
 /// <returns>The number of rows affected or -1 on error.</returns>
 public int NonQuery(string querytext, SQLParamList paramlist)
 {
     return(NonQuery(querytext, paramlist.ToArray()));
 }