10 Replies - 14546 Views - Last Post: 12 April 2010 - 02:28 AM Rate Topic: -----

#1 SedoSan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 15-June 09

"Could not find .mdb file" error after publish

Posted 15 June 2009 - 07:16 AM

I'm working on a project, doing fine until now, when debugging it gives no errors and works fine, but after I publish it online and download it, i get an error like this
System.Data.OleDb.OleDbException: Could not find file 'C:\Documents and Settings\Local Settings\Apps\2.0\Data\5OBGY35Z.KQX\BA0L3897.GKJ\monk..tion_e4d7ac4b0efe78e1_0003.0000_40bef6809ef62922\Data\EquipmentWS.mdb'.

although searching a little around that path i find the whole files including the 4 database.mdb there, and when i launch the program from that path, it works with no problems. But running the program from the installed files from the online setup still gives me an error.

My program contains 4 Access databases. They all are in the main program path with the other files, and all of them follow this pattern:
con_name.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = name.mdb"

change name with the database.mdb name

and this is the full error details:

System.Data.OleDb.OleDbException: Could not find file 'C:\Documents and Settings\Local Settings\Apps\2.0\Data\5OBGY35Z.KQX\BA0L3897.GKJ\monk..tion_e4d7ac4b0efe78e1_0003.0000_40bef6809ef62922\Data\EquipmentWS.mdb'.
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(DbConnect
ion 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 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, Commandbehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, Commandbehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at MDC.EquipmentWSDataSetTableAdapters.FeetTableAdapter.Fill(FeetDataTable dataTable)
at MDC.Main.Form1_Load(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.onload(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Monk Damage Calculator
Assembly Version: 1.0.4.0
Win32 Version: 1.0.4.0
CodeBase: file:///C:/Documents%20and%20Settings/Kelley%
----------------------------------------
Monk Damage Calculator
Assembly Version: 1.0.4.0
Win32 Version: 1.0.4.0
CodeBase: file:///C:/Documents%20and%20Settings/Kelley%20Wheaton/Local%20Settings/Apps/2.0/BRCEY2OH.QW8/4T4QX2XL.AQL/monk..tion_e4d7ac4b0efe78e1_0003.0000_40bef6809ef62922/Monk%20Damage%20Calculator.exe
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Data.DataSetExtensions
Assembly Version: 3.5.0.0
Win32 Version: 3.5.21022.8 built by: RTM
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Data.DataSetExtensions/3.5.0.0__b77a5c561934e089/System.Data.DataSetExtensions.dll
----------------------------------------
System.Core
Assembly Version: 3.5.0.0
Win32 Version: 3.5.21022.8 built by: RTM
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
Accessibility
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Transactions
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.1433 (REDBITS.050727-1400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------


************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

I'm still struggling from this, I'd appreciate any help. Thank you.

This post has been edited by born2c0de: 16 June 2009 - 03:39 AM


Is This A Good Question/Topic? 0
  • +

Replies To: "Could not find .mdb file" error after publish

#2 SedoSan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 15-June 09

Re: "Could not find .mdb file" error after publish

Posted 16 June 2009 - 03:07 AM

is the problem so hard no one can solve it?
Was This Post Helpful? 0
  • +
  • -

#3 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 180
  • View blog
  • Posts: 4,667
  • Joined: 26-November 04

Re: "Could not find .mdb file" error after publish

Posted 16 June 2009 - 03:47 AM

Pass the path along with the database name every time you access it.
If your app starts from different paths, append Application.StartupPath to the database.
Was This Post Helpful? 0
  • +
  • -

#4 noorahmad  Icon User is offline

  • Untitled
  • member icon

Reputation: 209
  • View blog
  • Posts: 2,290
  • Joined: 12-March 09

Re: "Could not find .mdb file" error after publish

Posted 16 June 2009 - 03:56 AM

copy your database file to your application directory

Quote

Pass the path along with the database name every time you access it.
If your app starts from different paths, append Application.StartupPath to the database.


con_name.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = "& Application.Stratup & "\name.mdb"

Was This Post Helpful? 0
  • +
  • -

#5 delicowa  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 34
  • Joined: 25-September 08

Re: "Could not find .mdb file" error after publish

Posted 16 June 2009 - 08:16 AM

check your applications settings and make sure your database is not set as "exclude from output directory"
Was This Post Helpful? 0
  • +
  • -

#6 honeypot  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 09-April 10

Re: "Could not find .mdb file" error after publish

Posted 09 April 2010 - 04:30 AM

hi, i need help here also.. i am new in vb.net and i am having the same problem with SedoSan.. May i know where is the application directory file?

delicowa: can u step out all the steps that need to take in order to do tat? thx.. =)
Was This Post Helpful? 0
  • +
  • -

#7 CharlieMay  Icon User is offline

  • This space intentionally left blank
  • member icon

Reputation: 1605
  • View blog
  • Posts: 5,162
  • Joined: 25-September 09

Re: "Could not find .mdb file" error after publish

Posted 09 April 2010 - 06:37 AM

Application.StartupPath will return the path of where the executable file (your program) is started from.

So if you program was in C:\Program Files\MyVBNETProgram that is what Application.StartupPath would return.

To use this with your mdb file, you would include in the connectionstring

"Data Source = " & application.startuppath & "\myMDBfile.mdb"

Keep in mind, this is assuming that your mdb file resides in the same location as your executable.

This post has been edited by CharlieMay: 09 April 2010 - 06:38 AM

Was This Post Helpful? 0
  • +
  • -

#8 honeypot  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 09-April 10

Re: "Could not find .mdb file" error after publish

Posted 10 April 2010 - 01:04 PM

CharlieMay: sorry that i am not quite understand in this part.. u said include in the connectionstring.. where is the connectionstring? is it in the my project setting there?
Was This Post Helpful? 0
  • +
  • -

#9 JoshD  Icon User is offline

  • D.I.C Head

Reputation: 9
  • View blog
  • Posts: 111
  • Joined: 22-March 10

Re: "Could not find .mdb file" error after publish

Posted 10 April 2010 - 07:10 PM

View Posthoneypot, on 10 April 2010 - 12:04 PM, said:

CharlieMay: sorry that i am not quite understand in this part.. u said include in the connectionstring.. where is the connectionstring? is it in the my project setting there?


if you are new to vb.net you are probably in WAY over your head to be handling databases already.

connectionstring is the string YOU have to set as for YOUR vb program to connect to the specified database.

If your database is a MS Access database, you will be using OLEDB as the API to connect with your database and your provider will (probably) be microsofts Jet provider (probably version 4.0), and when you google your problems, you may notice the term ADO.NET appear a lot, that is not wrong. I don't fully understand it myself, but it is basically a framework that you can (and have to) use in vb.net when talking about databases.

Hope this helps.

JD.
Was This Post Helpful? 0
  • +
  • -

#10 honeypot  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 09-April 10

Re: "Could not find .mdb file" error after publish

Posted 12 April 2010 - 12:37 AM

Is put in the form that i connect to database or the MY PROJECT SETTING there?

This post has been edited by honeypot: 12 April 2010 - 02:30 AM

Was This Post Helpful? 0
  • +
  • -

#11 honeypot  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 09-April 10

Re: "Could not find .mdb file" error after publish

Posted 12 April 2010 - 02:28 AM

i am doing the POS system. I have one database only . When i run the program in the VB.net Application, it has no error, the program work fine. But after i publish it and install into my computer. I run the program, it still can work when in the login part, it can retrieve the database in the login part but cannot work in the Sales part.. I really have no idea on what is wrong with my database connection. I have try many way but fail. hope someone can give me some direction. really thx a lot. below are the error message and detail it gave me.

Posted Image
The error message pop out.

Below is the details error message given:

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at Beauty_Saloon.Sales.Button8_Click(Object sender, EventArgs e)
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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3603 (GDR.050727-3600)
CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Beauty Saloon
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Documents%20and%20Settings/Elyn/Local%20Settings/Apps/2.0/OA4OCTLE.RVM/ZJWKAJCD.948/beau..tion_ba9e53d830d4522a_0001.0000_c20cb27cfe75b368/Beauty%20Saloon.exe
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Transactions
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------
Accessibility
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Attached File(s)


This post has been edited by honeypot: 12 April 2010 - 02:32 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1