SQL connection string

Source: Internet
Author: User

Select XH, Coun (*) CNT from lqk group by XH having count (*)> 1

Sele s1.xh from lqk S1, lqk S2 wher s1.ksh <> s2.ksh and s1.xh = s2.xh

Create several custom columns in the gridview, obtain the values in the background, write a stored procedure, and store data in the database,
In fact, there is a good method.
1. Create a file first. Null. Only the. udl file is required. For example, ABC. udl.
2. Double-click the file to display a database connection interface.
3. Set it in this interface and save it. Remember to save the password.
4. open the file in a text editor. The string is the link string you want.
Of course, remember to delete this file after use. Because there is data in it.

@ "Datasource =./sqlexpress; attachdbfilename = | datadirectory |/chengji. MDF; Integrated Security = true; user instance = true ";

<Deleetask>

<Add key = "connstr" value = "Data Source =./sqlexpress; attachdbfilename = | datadirectory |/news. MDF; Integrated Security = true; user instance = true"/>

</Appsettings>

Add between <configuration>
<Deleetask>
<Add key = "sqlconnectionstring" value = "Server = localhost; uid = sa; Pwd =; database = sqldataname;"/>
</Appsettings>
Use the following statement when calling
String connstr = configurationsettings. etettings ["sqlconnectionstring"];
Sqlconnection sqlconn = new sqlconnection (connstr );
Sqlconn. open (); // open the connection
...
Sqlconn. Close (); // close the connection

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.