如何使用静态IP在“我的服务器本地”上访问“我的数据库”文件夹共享 [英] what can i do to Access My DataBase Folder share on My Server Local with Static IP
问题描述
我,使用此代码在本地服务器文件夹上访问我的数据库Shar名称dbakar
if(new System.Web.UI.Page()。Session [GetYear]!= null)
{
string dbPath2 = new System.Web.UI.Page()。Server.MapPath(D:/ dbakar / " +rent+ new System.Web.UI.Page()。Session [GetYear]。ToString()+。mdb");
connectionString =" Provider = Microsoft.Jet.OLEDB.4.0; Data Source =" + dbPath2;
}
conn.ConnectionString = connectionString;
显示此错误
------------------
System.Web.HttpException :'D:/dbakar/rent2013.mdb'不是有效的虚拟路径。位于System.Web.HirtualPath.Create(String virtualPath,VirtualPathOptions选项)的System.Web.HttpServerUtility.MapPath(字符串路径)位于GenericDataAccess.CreateCommand()的ShowDataAccess.GetUserAll(Int32 Id_Num,String Pass)位于MasterPage.btnLogin_Click(Object发件人,EventArgs e
I,m Using This Code to Access My DataBase On Local Server Folder Shar Name dbakar
if (new System.Web.UI.Page().Session["GetYear"] != null)
{
string dbPath2 = new System.Web.UI.Page().Server.MapPath("D:/dbakar/"+"rent"+ new System.Web.UI.Page().Session["GetYear"].ToString() + ".mdb");
connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dbPath2;
}
conn.ConnectionString = connectionString;
display This Error
------------------
System.Web.HttpException: 'D:/dbakar/rent2013.mdb' is not a valid virtual path. at System.Web.VirtualPath.Create(String virtualPath, VirtualPathOptions options) at System.Web.HttpServerUtility.MapPath(String path) at GenericDataAccess.CreateCommand() at ShowDataAccess.GetUserAll(Int32 Id_Num, String Pass) at MasterPage.btnLogin_Click(Object sender, EventArgs e
推荐答案
转到http://connectionstrings.com/您将看到最适合您项目的连接字符串。享受
go to http://connectionstrings.com/ you will see the best connection string that suits your project. enjoy
这篇关于如何使用静态IP在“我的服务器本地”上访问“我的数据库”文件夹共享的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!