ADO. NET database access technology, ado.net Database Access
1. Definitions of ADO. NET
ADO. NET comes from the COM Component Library ADO (ActiveX Data Objects), is a new generation of
Optimization of. Net's frequent access to the database (1). net's access to data
Knowledge points: DataTable, Linq, lamda expressions, Cache
Scenario: Query all employees and administrators of a department and assign corresponding permissions.
The implementation process is generally: Query departments, traverse departments (query employees, assign permissions, qu
Two common methods for. NET to access the database in C language:. net to access data
1. directly use C # To operate the Database Class Library ADO. NET
ADO.
(Note: This article is helpful if you want to use the Oracle 9i Database in vs.net)
Original Author nameOTN
Original Article SourceOracle OTNIntroductionIntroduction to ODP. net
BodyOracle data provider for. net release 9.2.0.2.102 installation and FAQsAuthor: OTN
ODP. NET offers high performance and efficient
Part 1
Original article:
Last month (vol. 2, issue 9), I gave an executive overview of the conversion process, and started looking at converting General VB6 code to VB. net. this month I will finish General conversions, including DLLs, then start on Database conversions. next month, in the final segment, I will cover converting ASP.
Database access is the most important part of all programming languages. C # provides the ADO. NET component for accessing the database. We will start with the most easy-to-use Microsoft Access database and discuss
I. ADO. NET's definition
ADO. NET originates from COM component Library ADO (that is, ActiveX Data Objects), is a new generation of Microsoft Company. NET database access model, is currently used by database program designers to develop based on.
System.Data.SqlClient; ...... The meaning of the connection string is: Log on to the computer named "(local)" Database server, the login user name is a, the password is B, and assume that a database named DBName has been created in SQL Server. SqlConnection conn = new SqlConnection ("server= (local); Database=dbname; User id=a; password=b; "); Conn. Open (); Ope
I believe that ASP. NET controls are quite comfortable to use, but I still feel that the controls have many defects. First, the portability is not very good,CodeThis is the king. The following provides the ADO. Net code. You only need to add this file to the app_code of the website project and modify several values so that you can easily access your local
Oracle ODP. NET database access connection string
Connection string attribute
Default Value
Description
Connection lifetime
0
Maximum life time (in seconds) of the connection when the database connection is returned to the connection pool, its creation time will be compared with
/*
I modified it for a day and finally found the path. HahaThe field type of the file content stored in access is OLE object.The field type of file content stored in SQL is: ImageThis code is the code for uploading files.
Code design implementation function: ASP. NET uploads files to a specified folder, Access database
access|asp.net| Upload | data | database
/*
I modified the day. Finally found the way. OhThe type of field in Access that holds the contents of the file is: OLE ObjectThe type of field in SQL that holds the contents of the file is: imageThis code is for uploading file code. Post-Finishing release download file code
Code Design Implementation function: ASP.
. State.tostring ();//For display in the UI, the same is not explainedif (Con. state = = System.Data.ConnectionState.Open){Con. Close ();//Shut down the databaseResponse.Write ("SQL Server database is closed");}Label2.Text = con. State.tostring ();2. Then connect to the Access database:Using System.data.oledb;//access Databas
();
}
. NET image access techniques for SQL Server databases: Read and display from SQL Server
Add the following code to the image display area:
asp:imageid="imgPhoto"runat="server"ImageUrl="ShowPhoto.aspx">/asp:image>
ShowPhoto. aspx subject code:
PrivateVoidPage_Load (ObjectSender, System. EventArgs e)
{
If(! Page. IsPostBack)
{
SqlConnection conn =NewSqlConnection ()
Conn. C
, the intermediate language (IL) generated after compilation is basically the same, so there is almost no impact on the performance.
Some features in earlier versions of VB, such as the inputbox function, the control array, and the support for ADO in the. NET Framework, were not directly equivalent. However, for these features that cannot be directly supported, Microsoft provides another feature named Micro
. Net to access the Oracle database link: ORA-02041: client database did not begin a transaction problem. . Net to access the Oracle database link: ORA-02041: client
to represent the physical path of the file location connected to the string database. Therefore, Server. MapPath () conversion is no longer required when obtaining the connection string.
Assume that the database connection string is configured in web. config. For example:
| DataDirectory | represents the app_data folder.
3. Rename database files
Rename your
know server. mappath, and this method does not work.
Later, by exploring and referring to other programs, we summarized the following methods to facilitate program migration without having to modify the ACCESS database path.
My web. config statement is as follows:
In the program's data category class, I took "sqlconnstring" and "dbpath" and connected them to a string "conn_string_non_dtc"Public static read
. asp. (Details can refer to the data table of the Forum database of the Moving network)
4. Rename your Access *.asax: Because the asp.net processing mechanism, by default, such requests are rejected directly, and there will be no resource-consuming problems with the parsing process Shi mentioned. In this way, you can also rename Access to *.config,*.
Label:I. ADO. The definition of net Ado. NET originates from COM component Library ADO (that is, ActiveX Data Objects), is a new generation of Microsoft Corporation. NET database access model is currently used by database program
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.