C#2.0 Universal Database Components (easy to understand) __ Database

Source: Internet
Author: User
Tags rar

Turn from: http://bbs.crfly.com/23653/ShowPost.aspxasp.net c#2.0 Universal Database Components ( Open source including instance source code )
Annex :
Dboperatorservice.rar (216K, download times: 247)/*?——————————————————————————?
| Title:ASP.Net c#2.0 Universal Database Component (open source containing instance source code) |
| Project:DBOperatorService.Data |
| Subarea:dataset |
| Author:ξ Xiao Yin ξ|
| website:www.crfly.com;bbs.52happy.net |
| Created date:01/16/2007 |
| Changed date:01/17/2007 |
?——————————————————————————? * * Use instructions: This component is completely open source and the encapsulation of the Microsoft Class Library, is very safe, attaching me to add the example source code;
Interested friends can study together. The function is simpler, but is very practical, gives the general hobby. NET Programming Friend
Let's get this over with. ^_^ Function Description: 1, the database one key switch
When your system is developed, your system automatically has access and SQL Server databases by default, and you are no longer bothered by changing your access system to SQL and modifying a lot of code.
2, just handwriting 20% of the Code
Components to the database, such as links, open and close, and so on often need to use database operations closed into classes, in the actual use, you do not have to remember those annoying class name and usage, a sentence of SQL to replace the past annoying code.
3. Database State Monitoring
In the previous development of the Web site, the database open and closed is timely for beginners to learn a stumbling block, in many cases, people will often forget to develop the site data to the shutdown of resource depletion, and use this component, you do not have to consider this issue.
ξ Xiao-Yin ξ Xiao Xin Network
Www.crfly.com
Bbs.52happy.net
01/17/2007
Use the method simple description:
1, code comparison 1) traditional Web site database programming Code Gridview1.datasource = ds. TABLES[TABLENAME1]. DefaultView;
Gridview1.databind (); 2 Use Dboperator.data database component Gridview1.datasource = ds;
Gridview1.databind (); 2. Database Configuration
Which database to use in Webconfig, open which.
<!add key= "Operatordatalink" value= "Dbacc.mdb"/>
<!--add key= "Operatordatalink" value= "uid=sa;pwd=sa;database=dbsql;server=." /--> 3, data source call
For example: 1 The DataSet calls the method:
protected void Page_Load (object sender, EventArgs e)
{
DataSet ds = Osddata.dataset ("SELECT * from Xiaoyin_user", 0, 0, "dstable");//Use component's Scdata class to implement dataset functionality Data source
Gridview1.datasource = ds; Bind data to the GridView
Gridview1.databind ();
} 2 Reader invocation method: protected void Page_Load (object sender, EventArgs e)
{
Using the Screader class to implement the DataReader function
Osdreader dr = new Osdreader ("SELECT * from Xiaoyin_user"); Loop Start Reader
while (Dr. Read ())
{
Output specified column
Response.Write (dr["u_name"] + "<br>");
}
Dr. Close ()//Turn off the reader
}
Implementation features:

Osddataset class
Read (DataSet method), insert, UPDATE, delete, statistic
1, read
DataSet Ds=osddata.dataset ("SELECT * from table WHERE condition", start line, number of rows, "virtual table name");
2, insert
Osddata.executenonquery ("INSERT into table (column 1, column 2) VALUES (variable 1, variable 2)");
3, update
Osddata.executenonquery ("UPDATE table set column 1 = variable A, column 2 = variable B WHERE condition");
4, delete
Osddata.executenonquery ("DELETE table WHERE condition");
5, statistics
Osddata.executescalar ("SELECT * from table WHERE condition", statistical type)
Statistical types are divided into two categories:
int integral type: 1
Double Small Points: 2//----------Osdreader class--------------------
Implementation function: Reading (DataReader reader mode)
Call Method:
Osdreader dr=new Osdreader ("SELECT * FROM table WHERE condition");
//--------------------------------------------
if (Dr. Read ())
{
Terminates the next row of reads immediately if the value of a particular condition exists
}
//--------------------------------------------
while (Dr. Read)
{
Iterate through the values that match the criteria
}
//--------------------------------------------
Call the value read out:
dr["column name"]. ToString ();
Close after use:
Dr. Close ();

Due to update the forum's source code, so upload the attachment can not download;

Additional download addresses are added:
Http://www.xxfly.cn/softcode/DBOperatorService.rar

Related Article

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.