T4Query.SqlServer provides developers with a single class to query SQL Server with the query.
T4Query.SqlServer auto support Sql Transaction
- If run query not fails: Commits the database transaction.
- If run query fails: Rolls back a transaction from a pending state.
T4Query.SqlServer always auto close the connection when done with the results returned (from below)
T4Query.SqlServer support return result:
- ExecuteNonQuery: return the number of rows affected.
- SqlDataReader: return a System.Data.SqlClient.SqlDataReader object.
- ExecuteXmlReader: return a System.Xml.XmlReader object.
- ExecuteScalar<TSource>: return the first column of the first row in the result set, or a null if the result set is empty. Returns a maximum of 2033 characters.
- DataTable: return a DataTable that contains elements.
- DataSet: return a DataSet with select multiple table.
- IEnumerable<TSource>: return an enumerator that can be used to iterate through the collection.
- List<TSource>: A List that contains elements from the input sequence.
- FirstOrDefault<TSource>: return default(TSource) if source is empty; otherwise, the first element in source.
- Also, provide the SetDBNull (object) function: return DBNull.Value if object is null