ADO (1)

Source: Internet
Author: User

The connection object is at the top level and is the gateway to all data requests

Database connection Process

SqlConnection theconnection = new SqlConnection ();            Create an object instance of connection            theconnection.connectionstring = "server=.; integrated security=true; ";            Set its connection string, local area Connection, integrated secure connection            //Before the connection string is passed as a parameter to the code that creates the Connection object instance, it is a good idea to assign it to a string            //string connectionstring = "Server =.; integrated security=true; ";            SqlConnection theconnection=new SqlConnection (connectionstring);            The connection string is passed as a parameter to the Create connection "            Theconnection.open ();            if (theconnection.state = = System.Data.ConnectionState.Open)                Console.WriteLine ("Database connection is Open");

SqlClient data provides another way to construct a connection string that uses the SqlConnectionStringBuilder object

The benefit of using SqlConnectionStringBuilder is that an exception is thrown when an invalid connection string is entered

Three ways to specify the properties of a connected data source

1 specifying the connection string through the ConnectionString property of the Connection object

2 passing the connection string into the constructor of the connection object

3 using the Data Source Configuration Wizard

ADO (1)

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.