PC Review


Reply
Thread Tools Rate Thread

deployment and database location

 
 
=?Utf-8?B?QmVu?=
Guest
Posts: n/a
 
      17th Jul 2004
Hi all
I have made a vb.net windows app that works great in design. But after deploying the app on the same design computer (my own) the app can not find any of the two databases it needs to operate. I have tried setting their connection strings to application.startupath, but with no luck.
My question is, what is the correct way to code a connection string so that it will be seen by the app on any computer when deployed, especially when one of the databases has a dataset.
Right now I have a copy of both databases in the application folder and in the bin and debug folders for testing and they are still not found by the .exe
 
Reply With Quote
 
 
 
 
One Handed Man \( OHM - Terry Burns \)
Guest
Posts: n/a
 
      17th Jul 2004
Post your connection strings and tell us where the databse is in reality (
path \\servername\share\dbname )



--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Ben" <(E-Mail Removed)> wrote in message
news:08F6AD36-E9D8-487E-9338-(E-Mail Removed)...
> Hi all
> I have made a vb.net windows app that works great in design. But after

deploying the app on the same design computer (my own) the app can not find
any of the two databases it needs to operate. I have tried setting their
connection strings to application.startupath, but with no luck.
> My question is, what is the correct way to code a connection string so

that it will be seen by the app on any computer when deployed, especially
when one of the databases has a dataset.
> Right now I have a copy of both databases in the application folder and in

the bin and debug folders for testing and they are still not found by the
..exe


 
Reply With Quote
 
=?Utf-8?B?QmVu?=
Guest
Posts: n/a
 
      17th Jul 2004
Ok
Here are the two strings I now use

Con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Replace(Application.StartupPath, "bin", "") & "Book.mdb"

This one below is the one to which there is a dataset attached and the code is copied from in the Windows Form Designer generated code area:

Me.odcBooks.ConnectionString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDBatabase L" & _
"ocking Mode=1;Data Source=""C:\Documents and Settings\My Name\My Documents\V" & _
"isual Studio Projects\About My Books\Books.mdb"";Jet OLEDB:Engine Type=5;Pro" & _
"vider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;p" & _
"ersist security info=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:E" & _
"ncrypt Database=False;Jet OLEDB:Create System Database=False;Jet OLEDBon't Cop" & _
"y Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID" & _
"=Admin;Jet OLEDB:Global Bulk Transactions=1"






"One Handed Man ( OHM - Terry Burns )" wrote:

> Post your connection strings and tell us where the databse is in reality (
> path \\servername\share\dbname )
>
>
>
> --
>
> OHM ( Terry Burns )
> . . . One-Handed-Man . . .
>
> Time flies when you don't know what you're doing
>
> "Ben" <(E-Mail Removed)> wrote in message
> news:08F6AD36-E9D8-487E-9338-(E-Mail Removed)...
> > Hi all
> > I have made a vb.net windows app that works great in design. But after

> deploying the app on the same design computer (my own) the app can not find
> any of the two databases it needs to operate. I have tried setting their
> connection strings to application.startupath, but with no luck.
> > My question is, what is the correct way to code a connection string so

> that it will be seen by the app on any computer when deployed, especially
> when one of the databases has a dataset.
> > Right now I have a copy of both databases in the application folder and in

> the bin and debug folders for testing and they are still not found by the
> ..exe
>
>
>

 
Reply With Quote
 
One Handed Man \( OHM - Terry Burns \)
Guest
Posts: n/a
 
      17th Jul 2004
The reason is simple.

You originally were in a Bin folder at the end of your project directory
structure. Your replace replaces Bin with "", this leaves you with

..........\

However, when you deploy this, if your directort does not end in bin, then
no replace is done. So Lets say you deployed to C:\TEST, your formula for
the connection string would result in the following


C:\TESTBOOK.MDB


SO . . . use a preprocessor directive

#If DEBUG Then

'Set your paths accordingly

#Else

'set your paths accordingly

#End If

OR

Add an app.config file and set a new key for this and have your program
read it on startup.









--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing

"Ben" <(E-Mail Removed)> wrote in message
news:BE3C806A-A344-4EC9-8D04-(E-Mail Removed)...
> Ok
> Here are the two strings I now use
>
> Con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &

Replace(Application.StartupPath, "bin", "") & "Book.mdb"
>
> This one below is the one to which there is a dataset attached and the

code is copied from in the Windows Form Designer generated code area:
>
> Me.odcBooks.ConnectionString = "Jet OLEDB:Global Partial Bulk Ops=2;Jet

OLEDB:Registry Path=;Jet OLEDBatabase L" & _
> "ocking Mode=1;Data Source=""C:\Documents and Settings\My Name\My

Documents\V" & _
> "isual Studio Projects\About My Books\Books.mdb"";Jet OLEDB:Engine

Type=5;Pro" & _
> "vider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet

OLEDB:SFP=False;p" & _
> "ersist security info=False;Extended Properties=;Mode=Share Deny

None;Jet OLEDB:E" & _
> "ncrypt Database=False;Jet OLEDB:Create System Database=False;Jet

OLEDBon't Cop" & _
> "y Locale on Compact=False;Jet OLEDB:Compact Without Replica

Repair=False;User ID" & _
> "=Admin;Jet OLEDB:Global Bulk Transactions=1"
>
>
>
>
>
>
> "One Handed Man ( OHM - Terry Burns )" wrote:
>
> > Post your connection strings and tell us where the databse is in reality

(
> > path \\servername\share\dbname )
> >
> >
> >
> > --
> >
> > OHM ( Terry Burns )
> > . . . One-Handed-Man . . .
> >
> > Time flies when you don't know what you're doing
> >
> > "Ben" <(E-Mail Removed)> wrote in message
> > news:08F6AD36-E9D8-487E-9338-(E-Mail Removed)...
> > > Hi all
> > > I have made a vb.net windows app that works great in design. But after

> > deploying the app on the same design computer (my own) the app can not

find
> > any of the two databases it needs to operate. I have tried setting their
> > connection strings to application.startupath, but with no luck.
> > > My question is, what is the correct way to code a connection string so

> > that it will be seen by the app on any computer when deployed,

especially
> > when one of the databases has a dataset.
> > > Right now I have a copy of both databases in the application folder

and in
> > the bin and debug folders for testing and they are still not found by

the
> > ..exe
> >
> >
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ClickOnce Deployment Location Chuck P Microsoft Dot NET Framework Forms 1 29th Jun 2006 07:03 PM
Help, .NET dll deployment path location Vincenzo Davi Microsoft Dot NET 2 3rd Nov 2003 06:35 AM
Re: Access Database Location for Project Deployment Paul Clement Microsoft VB .NET 3 18th Sep 2003 10:03 PM
Re: Access Database Location for Project Deployment Cor Microsoft VB .NET 2 17th Sep 2003 06:30 PM
Re: Access Database Location for Project Deployment Jeff Molby Microsoft VB .NET 0 17th Sep 2003 03:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:31 AM.