Cyq. Data lightweight data layer Instant Messaging Software
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. 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 type
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?
Answer: Please generate cyq. Data. SQL. outputdata and generate enumeration. You can find any background code on the ASPX page.
Outputdata DATA = new cyq. Data. SQL. outputdata ("messageconn ");
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 (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> (users. username); // Description: Get and set are for non-UI type
Action. Close ();
}