asp.net c#2.0 Universal Database components (including download instance source address)

Source: Internet
Author: User
Tags insert table name
asp.net| Data | database | download

/* ?——————————————————————————?
| Title:ASP.Net c#2.0 AlmightyDatabaseComponents (open source with instancesSource 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 |
?——————————————————————————? */

Instructions for use:

This component completely open source and the encapsulation of the Microsoft Class Library, is very safe, attached to the source of my supplemental example;
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 is automatically equipped with access and SQL Server databases by default

, and you're no longer bothered by changing your access system to SQL and modifying a lot of code.
2, just handwriting 20% of the Code
Component to block database operations such as linking, opening, closing, and so on, and using them in a class, you don't need to

Remember those annoying class names and usages, and a SQL statement replaces the annoying code of the past.
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 in the development

The web site often forgets that the data is off and the resource is depleted, and you don't have to think about it since you use this component.

Use the method simple description:
1, code comparison

1 traditional Web site database programming code

Gridview1.datasource = ds. TABLES[TABLENAME1]. DefaultView;
Gridview1.databind ();

2 Using Dboperator.data Database Components

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 Group

The Scdata class of the piece, realizes the dataset function

Data source
Gridview1.datasource = ds;

Bind data to the GridView
Gridview1.databind ();
}

2 Reader Call 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 Belt Decimal 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 ();

The download address is as follows:
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.