ASP.NET连接SQL和ACCESS的方法

SQL:

using System.Data.SqlClient;

string sql = "server=.;uid=sa;pwd=;database=tablename;";


ACCESS:

using System.Data.OleDb;

string sql = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" + HttpRuntime.AppDomainAppPath + "//App_Data//db.mdb";

 HttpRuntime.AppDomainAppPath  为根目录 

 

你可能感兴趣的:(asp.net)