SqlConnection myConnection=new SqlCOnnection()
myConnection.ConnectionString =”Data Source=localhost;”+Initial Catalog=Pubs;Integrated Security=”SSPI”;
<configuration>
<connectionStrings>
<add name=”Pubs” connectionString=”Data Source=localhost;Initial Catalog=Pubs;Integrated Security=”SSPI”
</connectionStrings>
…
</configuration>
String connectionString=WebConfigurationManager.ConnectionStrings[“Pubs”].ConnectionString;
SqlCommand myCommand=new SqlCommand();
myCommand.Connection=myConnection;
myCommand.CommandText=”Selet * form authors”;
or
SqlCommand myCommand=new SqlCommand(“select *from authors”,myConnection);
原来在独处的时候,才知道有种心情叫做寂寞,会在心口慢慢划过,在心里蔓延开的不是血液,而是思念!