1. CyQ. Data Description: CyQ. Data. DLL for the trial version, please temporarily renew for the business purpose of the task project CyQ. Data. DLL: http://files.cnblogs.com/cyq1162/CyQ.Data.rar
Features:
L supports SQL Server 2000/2005. Net 2.0. Other databases are not supported currently
L you can directly reference the DLL without any configuration. If you need a configuration, it is the default connection string in webConfig <add name = "MyConn" connectionString = "XXX"/>, if this parameter is not specified, it can be passed in the class constructor.
L simple and easy to use.
2. Instructions for use
This tool is Based on. NET 2.0, so it cannot be used in. NET 1.1 projects.
First, add SyQ. Data Reference to your project.
Main classes of this DLL:
MDataRow ---- mainly used for data operations
MDataTable ---- data table, return form of data operation [query], can be directly bound to the control
MDataResult ----- result returned by data operations [update, insert, delete, and so on], enumeration type
Simple use example [you can experience the details or leave a message to ask]:
I. Single-table and multi-Table operations [use a view for multiple tables]
Ii. Stored Procedure operations
I. Single-table and multi-Table operations [use a view for multiple tables]
1. insert [MDataRow data rows will be directly filled after data insertion]:
A: MDataRow MCM = new MDataRow ("table name/view name ");
MCM ["field name"]. Value = data;
MCM. Insert ();
MCM. Close ();
B: MDataRow MCM = new MDataRow ("table name/view name ");
MCM. AutoPrefix = "txt"; // control prefix
MCM ["field name"]. Value = data; // process fields received directly from the control
MCM. Insert (True); // in this case, data will automatically receive [Control name = prefix + field name] From the Page Control
MCM. Close ();
2: Update:
A MDataRow MCM = new MDataRow ("table name/view name ");
MCM ["primary key field"]. Value = data;
MCM. Update ("id = 2"); // where statement
MCM. Close ();
B MDataRow MCM = new MDataRow ("table name/view name ");
MCM ["field name"]. Value = data;
MCM. Update (true); // automatically receives data from the page control
MCM. Close ();
3. Delete:
MDataRow MCM = new MDataRow ("table name/view name ");
MCM. Delete ("id = 2"); // where statement
MCM. Close ();
4. Query [and bind]:
Single Row filling:
MDataRow MCM = new MDataRow ("table name/view name ");
If (MCM. FillMySelf (ID) // according to the ID
{String aa = MCM ["field name"]. Value. ToString ();}
A: MDataRow MCM = new MDataRow ("table name/view name ");
MDataTable mdt = MCM Select (0, 0, "id = 2"); // The first two zeros indicate that all records are taken out.
MCM. Close ();
Repeater1.DataSource = mdt;
Repeater1.DataBind ();
B: Total number of records
Int RowCount;
MDataRow MCM = new MDataRow ("table name/view name ");
MDataTable mdt = MCM Select (1, 10, "id = 2", True, out RowCount );
MCM. Close ();
Repeater1.DataSource = mdt;
Repeater1.DataBind ();
Ii. Stored Procedure operations
1. Only the stored procedure is executed.
MDataRow MCM = new MDataRow (True );
MDataTable mdt = (MDataTable) mcm. ExecuteProcDataReader ("Stored Procedure name ");
Int RowCount = mcm. ReturnValue; // The total number of records.
MCM. Close ();
Try other operations or leave a message on your own