SQLDataSource連結非SQLServer資料庫
若有使用到SQLDataSource,連結的資料庫通常都是SQLServer
但若有一天客戶的需求是要連結到不同的資料庫(如:Oracle,Informix)怎麼辨呢?Don't Worry...只要在組態檔設定如下即可解決囉
<asp:SqlDataSource ID="SqlDataSource1"
runat="server"
ConnectionString="<%$ ConnectionStrings:FormConnectionString %>"
ProviderName="<%$ ConnectionStrings:FormConnectionString.ProviderName %>" SelectCommand='SELECT * FROM "PJSUBPJ"'>
</asp:SqlDataSource>
ConnectionString="<%$ ConnectionStrings:FormConnectionString %>"
ProviderName="<%$ ConnectionStrings:FormConnectionString.ProviderName %>" SelectCommand='SELECT * FROM "PJSUBPJ"'>
</asp:SqlDataSource>
<connectionStrings>
<add name="FormConnectionString" connectionString="Data Source=oracle9i.systemlead.com;Persist Security Info=True;User ID=caita;Password=caita;Unicode=True"
providerName="System.Data.OracleClient" />
</connectionStrings>
<add name="FormConnectionString" connectionString="Data Source=oracle9i.systemlead.com;Persist Security Info=True;User ID=caita;Password=caita;Unicode=True"
providerName="System.Data.OracleClient" />
</connectionStrings>