CYQ. The path to the lightweight Data layer of Data)

Source: Internet
Author: User
Tags connectionstrings

In fact, I didn't want to write help because there are a lot of examples in the following articles:

 

CYQ. Data lightweight Data layer application example 1 message board (4)

CYQ. Data lightweight Data layer road to gorgeous upgrades V1.3 (5)

CYQ. Data lightweight Data layer path application example 2 online chat (6)

CYQ. Data lightweight Data layer elegant V1.4 now with API help documentation (9)

 

However, many people are still very lazy. when they enter the group, they will ask how to use it.

Let's take a look at the path of an article. It's too troublesome and complicated to use, So I thought about it. I 'd like to write and use tutorials to make this part easy.

 

The latest version is V1.4.

Download the latest version: CYQ. Data lightweight Data layer bug feedback, optimization suggestions, and latest framework download

 

The procedure is as follows:

I. Download the framework DLL

Go to the above download URL, download the framework, decompress it, there is a 60 k size file: CYQ. Data. dll

 

Ii. add reference to a project

Add CYQ. Data. dll to project reference

 

3. Configure database links

<ConnectionStrings>
<Add name = "Conn" connectionString = "database link string, do not say it won't be written"/>
</ConnectionStrings>

 

4. Generate the paging stored procedure into the database

 

Generate CYQ. Data. SQL. OutPutData, and find the background code of the aspx page for execution:

OutPutData data = new OutPutData ();
Data. ExeCreateProc (FiledDescriptionType. Sql2005 );

 

 

 

V. naked on the battlefield

 

1: bare Mode

Try 1: Data Binding

MAction action = new MAction ("table name ");
GridView1.DataSource = action. Select ();
GridView1.DataBind ();
Action. Close ();

 

Try 2: Data Filling

MAction action = new MAction ("table name ");
If (action. Fill (888) // obtain the value of id = 888
{
Action. SetTo (labUserName); // Description: SetTo and GetFrom are operations on the UI control.
// LabUserName is the Lable control. The Control ID is set to "three letter Prefixes" + field names. For example, labUserName and UserName are table field names.
Int userName = action. Get <int> ("UserName"); // Description: Get and Set are for non-UI action. Close ();
}

 

2: semi-naked

 

Q: The above example shows "table name" and "UserName". If the code is so broken, it is difficult to find the problem if you modify the field or table name?

 

Reply: continue to generate CYQ. Data. SQL. OutPutData, generate enumeration, and find any background code on the aspx page.

 

OutPutData data = new OutPutData ();
Response. Write (data. OutPutAllTableEnum (TableType. U, FiledDescriptionType. Sql2005, false ));

 

Operation: Create a class named TableNames. cs, delete all automatically generated information, leave blank, and copy and paste the enumeration output above.

 

Try again 1: Data Binding

MAction action = new MAction (TableNames. Users); // The enumerated values are passed.
GridView1.DataSource = action. Select ();
GridView1.DataBind ();
Action. Close ();

 

Try again 2: Data Filling

MAction action = new MAction (TableNames. Users );
If (action. Fill ("id = 888") // second usage
{
Action. SetTo (labUserName); int userName = action. Get <int> (Users. UserName); // enumerate action. Close ();
}

 

 

Statement:

Okay. After reading this article, I still said it won't be used. I won't beat you to death, just like ~!~~~~ Laugh !! For other usage, see the next article: The name is not fixed.
Of course, in addition to CYQ. Data. dll, this framework also creates API help documents and auxiliary tools to help you use this framework more conveniently.
Tip: The Page Control source code of the Post article is also attached to the page control for direct package and download.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.