Hi,

Your exe from desktop, perhaps, crashes because it can no longer find the
resources referenced by it (and present in debug folder)

For test purpose you can try ../../db/test.db3

But this will fail on deployment. You need to programmatically find the exe
location. One of the following may help:
1. Appliaction.StartupPath
2. Application.ExecutablePath
3. System.Reflection.Assembly.GetExecutingAssembly()

Thanks and Regards
Taleeb Anwar

*Hum Mashriq Ke "Miskeenon" Ka Dil Maghrib men Ja Atka Hai!!*




On Tue, Feb 21, 2012 at 7:02 PM, Pavel Ivanov <[email protected]> wrote:

> > Just a quick note though, when I move the .exe file to the desktop and
> double-click on it, it crashes, which suggests that the bin/debug location
> is only applicable when the application is run from within the IDE.
>
> Crash is probably because your desktop folder doesn't have db
> subdirectory where you want your database to be created. All relative
> paths are always relative to the current directory, not to the place
> where EXE file is located or where it was built.
>
>
> Pavel
>
>
> On Mon, Feb 20, 2012 at 10:11 PM, Agrawal, Manish <[email protected]>
> wrote:
> > Ah, I should have thought of that.
> >
> > When I run the application (Ctrl+F5), the path is created in bin/debug.
> This is also the folder where the .exe file is created.
> >
> > Just a quick note though, when I move the .exe file to the desktop and
> double-click on it, it crashes, which suggests that the bin/debug location
> is only applicable when the application is run from within the IDE.
> >
> > Thanks
> > Manish
> >
> > -----Original Message-----
> > From: [email protected] [mailto:
> [email protected]] On Behalf Of Simon Slavin
> > Sent: Monday, February 20, 2012 9:51 PM
> > To: General Discussion of SQLite Database
> > Subject: Re: [sqlite] Relative path to sqlite database
> >
> >
> > On 21 Feb 2012, at 2:49am, "Agrawal, Manish" <[email protected]> wrote:
> >
> >> All the sqlite examples I see use absolute paths to the sqlite database
> in Visual Studio projects, e.g. "C:\users\test\apps\db\test.db3".
> >>
> >> How can I specify the path to the sqlite database relative to the
> application root folder, e.g. "db\test.db3"?
> >
> > Have you tried specifying a filename without a path, just to see where
> the file ends up ?
> >
> > Simon.
> > _______________________________________________
> > sqlite-users mailing list
> > [email protected]
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> > _______________________________________________
> > sqlite-users mailing list
> > [email protected]
> > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> _______________________________________________
> sqlite-users mailing list
> [email protected]
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to