Cadcorp.DataAccess Namespace |
[Missing <summary> documentation for "N:Cadcorp.DataAccess"]
Class | Description | |
---|---|---|
![]() | DbDatabase |
The SqlDatabase class contains the core functionality of establishing a
connection with an SQL Server database and executing simple stored procedures.
USAGE - Create a class which derives from this, and specify a Provider. I.E
public bool IsUser(string userName, string password) {
Provider = connectionString.ProviderName;
string queryText = string.Format("select * from users where UserID = {0} and password = {1}",GetDBParameterString("UserId"),GetDBParameterString("Password"));
DbParameter[] parameters = { GetParameter("UserId",userName), GetParameter("Password",password) };
parameters[0].Value = userName;
parameters[1].Value = password;
DbResultSet resultSet = RunQuery(ConnectionString.ConnectionString, queryText, parameters);
bool isUser = resultSet.HasRows;
resultSet.Close();
return isUser;
}
The DbResultSet class can be used to iterate through returned data quite nicely :
i.e.
DbResultSet resultSet = RunQuery(ConnectionString.ConnectionString, queryText, parameters);
while(resultset.Next(){
string returnedValue = resultSet.GetString("ReturnedFieldName");
}
resultSet.Close();
More functionality for the DbResultSet is explained in the DbResultSet file, and the ResultSet file.
|
![]() | DbResultSet |
Contains the results of a query to an SqlServer database:
|
![]() | ResultSet |
A ResultSet contains the results returned from a database query (generally a table with multiple rows and fields).
This class can be inherited from to create a ResultSet for a specific type of database object, e.g. a data reader.
|