人生是一场不能存盘的RPG,我只能尽量多搞几个Screenshot

May 19, 2006

.NET 2.0中的connection string

Filed under: SQL&DB Accessing

//——————————————-

    config 文件中的connection stirng

//——————————————-

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
    </configSections>
    <connectionStrings>
        <add name="MyDB" connectionString="Data Source=myServer;Initial Catalog=myDB;Integrated Security=True"                                            providerName="System.Data.SqlClient" />
    </connectionStrings>
</configuration>

//——————————————-

    读取

//——————————————-

    string conn = ConfigurationManager.ConnectionStrings["MyDB"].ConnectionString;
         

Comments »

The URI to TrackBack this entry is: http://recordsome.blogsome.com/2006/05/19/p44/trackback/

No comments yet.

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>



Anti-spam measure: please retype the above text into the box provided.






















Get free blog up and running in minutes with Blogsome
Theme designed by Hadley Wickham