System.Data.OleDb.OleDbException未处理:不是有效路径

时间:2022-09-10 15:37:12

This is my first attempt trying to access db files from the server. If run the program locally there are no problems

这是我第一次尝试从服务器访问db文件。如果在本地运行程序没有问题

I stored ms access files on the server and I trying to run the program from my laptop and I am recieving the following error....

我在服务器上存储ms访问文件,我试图从我的笔记本电脑运行程序,我收到以下错误....

System.Data.OleDb.OleDbException was unhandled is not a valid path.  Make sure that the path 
name is spelled correctly and that you are connected to the server on which the file resides.

My connection string looks something like this...

我的连接字符串看起来像这样......

myCon = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=H:\name-SERVER\SHAREDFILES\FileRDB.mdb; Jet OLEDB:System Database=system.mdw");

There has username and password for the server. Should I include this in the connection string?

有服务器的用户名和密码。我应该在连接字符串中包含它吗?

Stacktrace looks like this...

Stacktrace看起来像这样......

System.Data.OleDb.OleDbException was unhandled
   is not a valid path.  Make sure that the path name is spelled correctly and that you are connected to the server on which the file resides.
  Source=Microsoft JET Database Engine
  ErrorCode=-2147467259
  StackTrace:
       at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
       at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
       at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.OleDb.OleDbConnection.Open()
       at MALHRManagementSystem.FrmLogin.btnLogin_Click(Object sender, EventArgs e) in C:\Users\username\Desktop\Project\foldername\foldername\foldername\Form.cs:line 40
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at somefilename.Program.Main() in C:\Users\username\Desktop\Project\foldername\foldername\foldername\Program.cs:line 18
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

Please can someone advise me how do I correct this problem.

有人可以告诉我如何纠正这个问题。

Thanks in advance

提前致谢

I am not sure what tag I should use for this thread but please correct it if I am wrong here.

我不确定我应该为这个帖子使用什么标签,但如果我错了,请纠正它。

db is MS-Access 2003 and visual studio 2010

db是MS-Access 2003和visual studio 2010

1 个解决方案

#1


0  

This is working now. To have a mapped network drive on vista/ Windows 7. Right click on My Computer > Map Network Drive > Select a drive > Click on Browse button . A menu appears as Browse For Folder -- Select a shared network folder. Then choose the network name and the folder. Once you have done that Click OK. That is all you have to do. Here are some useful links on howto if anyone is interested...

现在正在运作。在vista / Windows上拥有映射的网络驱动器7.右键单击“我的电脑”>“映射网络驱动器”>“选择驱动器”>单击“浏览”按钮。菜单显示为“浏览文件夹” - 选择共享网络文件夹。然后选择网络名称和文件夹。完成后单击“确定”。这就是你所要做的。如果有人有兴趣,这里有一些有用的链接如何...

here

here

Vista

#1


0  

This is working now. To have a mapped network drive on vista/ Windows 7. Right click on My Computer > Map Network Drive > Select a drive > Click on Browse button . A menu appears as Browse For Folder -- Select a shared network folder. Then choose the network name and the folder. Once you have done that Click OK. That is all you have to do. Here are some useful links on howto if anyone is interested...

现在正在运作。在vista / Windows上拥有映射的网络驱动器7.右键单击“我的电脑”>“映射网络驱动器”>“选择驱动器”>单击“浏览”按钮。菜单显示为“浏览文件夹” - 选择共享网络文件夹。然后选择网络名称和文件夹。完成后单击“确定”。这就是你所要做的。如果有人有兴趣,这里有一些有用的链接如何...

here

here

Vista