1.DatabaseFactory.CreateDatabase():Method for invoking a default Database object. Reads default settings from the ConnectionSettings.config file.

What did I learn from the QucikStart about DAAB?Database dbSvc = DatabaseFactory.CreateDatabase();

2.Database.GetSqlStringCommand(string query):Create a DbCommand for a SQL query.

What did I learn from the QucikStart about DAAB?Database db = DatabaseFactory.CreateDatabase();
What did I learn from the QucikStart about DAAB?
What did I learn from the QucikStart about DAAB?
string sqlCommand = "Select CustomerID, Name, Address, City, Country, PostalCode " +
What did I learn from the QucikStart about DAAB?    
"From Customers";
What did I learn from the QucikStart about DAAB?DbCommand dbCommand 
= db.GetSqlStringCommand(sqlCommand);

3.Database.ExecuteReader(DbCommand command):Executes the command and returns an IDataReader through which the result can be read. It is the responsibility of the caller to close the connection and reader when finished.

What did I learn from the QucikStart about DAAB?using (IDataReader dataReader = db.ExecuteReader(dbCommand))
}

4.Database.GetStoredProcCommand(string storedProcedureName):Creates a DbCommand for a stored procedure.

What did I learn from the QucikStart about DAAB?string sqlCommand = "GetProductsByCategory";
What did I learn from the QucikStart about DAAB?DbCommand dbCommand 
= db.GetStoredProcCommand(sqlCommand);

5.Database.AddInParameter(DbCommand command,string name,DbType dtType,Object value):Adds a new In DbParameter object to the given command. With the value.

What did I learn from the QucikStart about DAAB?db.AddInParameter(dbCommand, "CategoryID", DbType.Int32, Category);

6.Database.ExecuteDataSet(DbCommand command):Executes the command and returns the results in a new DataSet.

What did I learn from the QucikStart about DAAB?productsDataSet = db.ExecuteDataSet(dbCommand);

7.Database.AddOutParameter(DbCommand command,string name,DbType dbType,int size):Adds a new Out DbParameter object to the given command.

What did I learn from the QucikStart about DAAB?db.AddOutParameter(dbCommand, "ProductName", DbType.String, 50);

8.Database.ExecuteNonQuery(DbCommand command):Executes the command and returns the number of rows affected.

What did I learn from the QucikStart about DAAB?db.ExecuteNonQuery(dbCommand);

9.Database.ExecuteScalar(DbCommand command):Executes the command and returns the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.

What did I learn from the QucikStart about DAAB?string productName = (string) db.ExecuteScalar(dbCommand);


10.Database.GetStoredProcCommand(string storeProcedureName,object[] parameterValues):Creates a DbCommand for a stored procedure with the parameter values.

What did I learn from the QucikStart about DAAB?string sqlCommand = "GetProductName";
What did I learn from the QucikStart about DAAB?DbCommand dbCommand 
= db.GetStoredProcCommand(sqlCommand, productID);

11,How to use the Transaction?

What did I learn from the QucikStart about DAAB?bool result = false;
What did I learn from the QucikStart about DAAB?
What did I learn from the QucikStart about DAAB?
// Create the Database object, using the default database service. The
What did I learn from the QucikStart about DAAB?
// default database service is determined through configuration.
What did I learn from the QucikStart about DAAB?
Database db = DatabaseFactory.CreateDatabase();
What did I learn from the QucikStart about DAAB?
What did I learn from the QucikStart about DAAB?
// Two operations, one to credit an account, and one to debit another
What did I learn from the QucikStart about DAAB?
// account.
What did I learn from the QucikStart about DAAB?
string sqlCommand = "CreditAccount";
What did I learn from the QucikStart about DAAB?DbCommand creditCommand 
= db.GetStoredProcCommand(sqlCommand);
What did I learn from the QucikStart about DAAB?
What did I learn from the QucikStart about DAAB?db.AddInParameter(creditCommand, 
"AccountID", DbType.Int32, sourceAccount);
What did I learn from the QucikStart about DAAB?db.AddInParameter(creditCommand, 
"Amount", DbType.Int32, transactionAmount);
What did I learn from the QucikStart about DAAB?
What did I learn from the QucikStart about DAAB?sqlCommand 
= "DebitAccount";
What did I learn from the QucikStart about DAAB?DbCommand debitCommand 
= db.GetStoredProcCommand(sqlCommand);
What did I learn from the QucikStart about DAAB?
What did I learn from the QucikStart about DAAB?db.AddInParameter(debitCommand, 
"AccountID", DbType.Int32, destinationAccount);
What did I learn from the QucikStart about DAAB?db.AddInParameter(debitCommand, 
"Amount", DbType.Int32, transactionAmount);
What did I learn from the QucikStart about DAAB?
What did I learn from the QucikStart about DAAB?
using (DbConnection connection = db.CreateConnection())
}

12.Database.LoadDataSet(DbCommand command,DataSet dataSet,string tableName):Executes the command and adds a new DataTable to the existing DataSet.

What did I learn from the QucikStart about DAAB?Database db = DatabaseFactory.CreateDatabase();
What did I learn from the QucikStart about DAAB?
What did I learn from the QucikStart about DAAB?DataSet productsDataSet 
= new DataSet();
What did I learn from the QucikStart about DAAB?
What did I learn from the QucikStart about DAAB?
string sqlCommand = "Select ProductID, ProductName, CategoryID, UnitPrice, LastUpdate " +
What did I learn from the QucikStart about DAAB?    
"From Products";
What did I learn from the QucikStart about DAAB?DbCommand dbCommand 
= db.GetSqlStringCommand(sqlCommand);
What did I learn from the QucikStart about DAAB?
What did I learn from the QucikStart about DAAB?
string productsTable = "Products";
What did I learn from the QucikStart about DAAB?
What did I learn from the QucikStart about DAAB?
// Retrieve the initial data
What did I learn from the QucikStart about DAAB?
db.LoadDataSet(dbCommand, productsDataSet, productsTable);

13.Database.UpdateDataSet(DataSet dataSet,string tableName,DbCommand insertCommand,DbCommand updateCommand,DbCommand deleteCommand,UpdateBehavior updateBehavior):Calls the respective INSERT, UPDATE, or DELETE statements for each inserted, updated, or deleted row in the DataSet.

What did I learn from the QucikStart about DAAB?string productsTable = "Products";
What did I learn from the QucikStart about DAAB?
What did I learn from the QucikStart about DAAB?
// Retrieve the initial data
What did I learn from the QucikStart about DAAB?
db.LoadDataSet(dbCommand, productsDataSet, productsTable);
What did I learn from the QucikStart about DAAB?
What did I learn from the QucikStart about DAAB?
// Get the table that will be modified
What did I learn from the QucikStart about DAAB?
DataTable table = productsDataSet.Tables[productsTable];
What did I learn from the QucikStart about DAAB?
What did I learn from the QucikStart about DAAB?
// Add a new product to existing DataSet
                                    deleteCommand, UpdateBehavior.Standard);

14.SqlDatabase.ExecuteXmlReader(DbCommand command):Executes the SqlCommand and returns a new XmlReader.

What did I learn from the QucikStart about DAAB?string sqlCommand = "Select ProductID, ProductName, CategoryID, UnitPrice, LastUpdate " +
What did I learn from the QucikStart about DAAB?    
"From Products FOR XML AUTO";
What did I learn from the QucikStart about DAAB?DbCommand dbCommand 
= dbSQL.GetSqlStringCommand(sqlCommand);
   XmlReader productsReader = null;
What did I learn from the QucikStart about DAAB?productsReader 
= dbSQL.ExecuteXmlReader(dbCommand);

相关文章:

  • 2021-06-07
  • 2021-07-25
  • 2022-12-23
  • 2022-02-23
  • 2021-07-05
  • 2022-12-23
  • 2022-02-06
  • 2021-08-22
猜你喜欢
  • 2021-07-06
  • 2022-12-23
  • 2022-02-23
  • 2021-04-29
  • 2022-12-23
  • 2021-07-03
  • 2021-06-05
相关资源
相似解决方案