ASP. net c #2.0 all-around database components (including download instance Source Code address)

Source: Internet
Author: User

/*? --------------------------?
| Title: ASP. net c #2.0 all-around database component (Open Source with instance source code) |
| Project: dboperatorservice. Data |
| Subarea: DataSet |
| Author: Mr. E |
| Website: www.crfly.com; bbs.52happy.net |
| Created Date: 01/16/2007 |
| Changed Date: 01/17/2007 |
? --------------------------? */
 
Instructions for use:
 
This component is completely open-source and re-encapsulated by the Microsoft class library. It is very secure and adds the instance source code I have added;
If you are interested, you can study together! Simple functions, but very practical, for the majority of friends who love. NET Programming
Let's talk about it. Pai_^
 
Function Description:
 
1. One-click Database Switch
After your system is developed, your system automatically has access and SQL Server database usage by default.
 
Since then, you no longer have to worry about modifying a lot of code because of changing the Access System to SQL.
2. You only need to write 20% of the Code.
Components close database operations that are frequently used to link, open, and close databases into classes. In actual use, you do not need
 
Remember the annoying class names and usage. An SQL statement replaces the annoying code.
3. Database Status Monitoring
In the past, when developing websites, it was difficult for beginners to open and close databases. In many cases, people are developing
 
When you use this component, you do not have to worry about it.

Simple instructions:
1. Code comparison
 
1) programming code for traditional WEB Website Databases
 
Gridview1.datasource = Ds. Tables [tablename1]. defaultview;
Gridview1.databind ();
 
2) use the dboperator. Data Database Component
 
Gridview1.datasource = Ds;
Gridview1.databind ();
 
2. Database Configuration
In webconfig, the database is opened.
<! Add key = "operatordatalink" value = "dbacc. mdb"/>
<! -- Add key = "operatordatalink" value = "uid = sa; Pwd = sa; database = dbsql; server =."/-->
 
3. Data Source call
Example: 1) dataset call method:
Protected void page_load (Object sender, eventargs E)
{
Dataset DS = osddata. dataset ("select * From xiaoyin_user", 0, 0, "dstable"); // use group
 
Scdata class to implement 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)
{
// Use the screader class to implement the datareader Function
Osdreader DR = new osdreader ("select * From xiaoyin_user ");
 
// Cyclically start the reader
While (dr. Read ())
{
// Output the specified Column
Response. Write (Dr ["u_name"] + "<br> ");
}
Dr. Close (); // close the reader
}

Functions:

Osddataset class
Read (Dataset mode), insert, update, delete, statistics
1. Read
Dataset DS = osddata. dataset ("select * from table where condition", start row, how many 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)
There are two statistical types:
Int INTEGER: 1
Double with decimal point: 2
 
// ---------- Osdreader class --------------------
Feature: Read (datareader reader)
Call method:
Osdreader DR = new osdreader ("select * from table where condition ");
//--------------------------------------------
If (dr. Read ())
{
// If the value of a specific condition exists, terminate the next row of reading immediately
}
//--------------------------------------------
While (dr. Read)
{
// Read the qualified values cyclically
}
//--------------------------------------------
The value read by the call:
Dr ["column name"]. tostring ();
Close after use:
Dr. Close ();

As follows:
Http://www.xxfly.cn/softcode/DBOperatorService.rar

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.