HELP! Cannot find the database after publish!

Cannot find the database after publish.. but login is ok, sales cannot

Page 1 of 1

4 Replies - 6021 Views - Last Post: 14 April 2010 - 02:33 PM Rate Topic: -----

#1 honeypot  Icon User is offline

  • New D.I.C Head

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

HELP! Cannot find the database after publish!

Posted 14 April 2010 - 10:29 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: 14 April 2010 - 10:37 AM


Is This A Good Question/Topic? 0
  • +

Replies To: HELP! Cannot find the database after publish!

#2 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: HELP! Cannot find the database after publish!

Posted 14 April 2010 - 10:36 AM

that is because your using fixed path to the database and user may put it not where you want to be. your using vb.net (visual basic 2008) right? it looks like to me. import Imports System.IO
and use this to get the application path
Dim strPath As String
Dim cnnSting As String           'connection string'
strPath = Path.GetDirectoryName(Application.ExecutablePath)
cnnSting = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath & "MyDataBase.mdb;"



now just input it to your connection string

EDIT: if it is vb6 use App.Path it will return your exe directory
good luck :)

This post has been edited by NoBrain: 14 April 2010 - 10:41 AM

Was This Post Helpful? 1
  • +
  • -

#3 honeypot  Icon User is offline

  • New D.I.C Head

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

Re: HELP! Cannot find the database after publish!

Posted 14 April 2010 - 11:34 AM

i search through internet and found that solution for the start up file. i tried but fail, i think is because my database is not in the same folder with .exe file. my database is in another folder.

What should i do?? How to i get the path to the database?? :helpsmilie:

This post has been edited by honeypot: 14 April 2010 - 12:09 PM

Was This Post Helpful? 0
  • +
  • -

#4 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 464
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

Re: HELP! Cannot find the database after publish!

Posted 14 April 2010 - 02:05 PM

well i suggest you put it in a folder where your exe is or in folder witch is in the folder of your exe. for example:
Dim strPath As String
Dim cnnSting As String           'connection string'
strPath = Path.GetDirectoryName(Application.ExecutablePath) & "\MyDBFolder\
cnnSting = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strPath & "MyDataBase.mdb;"


Was This Post Helpful? 0
  • +
  • -

#5 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1639
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: HELP! Cannot find the database after publish!

Posted 14 April 2010 - 02:33 PM

Moved to VB.NET
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1