<connectionStrings>
<add name="MSPetShop4ConnectionString" connectionString="Data Source=WXHX-ACCORD;Initial Catalog=MSPetShop4;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>web.config里面有这么一段,我应该怎么调用阿?
怎么才能付给DB_CONN_STRING OleDbConnection conn = new OleDbConnection(DB_CONN_STRING);
OleDbCommand cmd = new OleDbCommand("select * from Item ");
conn.Open();
<add name="MSPetShop4ConnectionString" connectionString="Data Source=WXHX-ACCORD;Initial Catalog=MSPetShop4;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>web.config里面有这么一段,我应该怎么调用阿?
怎么才能付给DB_CONN_STRING OleDbConnection conn = new OleDbConnection(DB_CONN_STRING);
OleDbCommand cmd = new OleDbCommand("select * from Item ");
conn.Open();
DB_CONN_STRING= System.Configuration.ConfigurationManager.ConnectionStrings["MSPetShop4ConnectionString"];
if (DB_CONN_STRING != null)
{
conn = new OleDbConnection (DB_CONN_STRING);
}
的话 是不能和OleDbConnection 一起用的?我应该怎么连?