Tuesday, June 10, 2008

Database Connection String for Web.Config

Access Database
<connectionstrings>
  <add name="AccessConnectionString"
   connectionString="Provider=Microsoft.Jet.OLEDB.4.0;
   Data Source=|DataDirectory|dbname.mdb"
   providerName="System.Data.OleDb" />
</connectionstrings>


ODBC Database
<connectionstrings>
  <add name="ODBCConnectionString"
   connectionString="DSN=dsnname;Uid=sa;Pwd=pwd;
   providerName="System.Data.Odbc” />
</connectionstrings>


SQLServer database
<connectionstrings>
  <add name="OLEDBConnectionString"
   connectionString="Server=servername;Integrated Security=SSPI;Database=dbname;"
   providerName="System.Data.SqlClient" />
</connectionstrings>


Excel Connection
<connectionstrings>
  <add name="OLEDBConnectionString"
   connectionString="Provider=Microsoft.Jet.OLEDB.4.0;
   Data Source= filename.xls; Extended Properties=Excel 8.0;"; />
</connectionstrings>


.csv file Connection
<connectionstrings>
  <add name="OLEDBConnectionString"
   connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=filename.csv;
   ExtendedProperties=""Text;HDR=Yes;FMT=Delimited""";/>
</connectionstrings>



Moreover you can use native connection methods for Oracle.

No comments: