Thursday, July 9, 2009

รวม Connection String สำหรับ .NET

Windows Authentication
string connectionString = "Data Source=localhost; Initial Catalog=Northwind;" +
"Integrated Security=SSPI";


SQL Server Authentication
string connectionString = "Data Source=localhost; Initial Catalog=Northwind;" +
"user id=sa; password=opensesame";


Oracle OLE DB
string connectionString = "Data Source=localhost; Initial Catalog=Sales;" +
"user id=sa; password=da#ta_li#nk_43;Provider=MSDAORA";


Access
string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" +
@"Data Source=C:\DataSources\Northwind.mdb";


Excel
string strExcelConn = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" +
Server.MapPath("Upload/" + excelFileName) + ";Extended Properties=Excel 8.0";


CSV
string strCsvConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
Server.MapPath("Upload") + ";Extended Properties=\"text;HDR=Yes;FMT=Delimited\"";

No comments:

Post a Comment