473,386 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

deployment and database location

Ben
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
Nov 20 '05 #1
3 1491
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" <Be*@discussions.microsoft.com> wrote in message
news:08**********************************@microsof t.com...
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
Nov 20 '05 #2
Ben
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 OLEDB:Database 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 OLEDB:Don'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" <Be*@discussions.microsoft.com> wrote in message
news:08**********************************@microsof t.com...
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

Nov 20 '05 #3
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" <Be*@discussions.microsoft.com> wrote in message
news:BE**********************************@microsof t.com...
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 OLEDB:Database 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 OLEDB:Don'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" <Be*@discussions.microsoft.com> wrote in message
news:08**********************************@microsof t.com...
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

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andy | last post by:
Hey All, I'm a beginner with VB.Dotnet Deployment and I'm a little confused about some very basic deployment issues . . . I've now created some core assemblies that will be used throughout all...
4
by: James | last post by:
I have a VB windows forms application that accesses a Microsoft Access database that has been secured using user-level security. The application is being deployed using No-Touch deployment. The...
0
by: Ian Henderson | last post by:
Hi folks I am currently writing all of my front-end applications in VB.NET 2002, and deploying them to the user's local machine using a deployment project. However, we now want to change the way...
1
by: moondaddy | last post by:
I need to have multiple deployment profiles for a .net 2.0 winforms project. This is my requirement: 1) Re-use same project for multiple ClickOnce deployment profiles. 2) Each profile will...
1
by: Gene | last post by:
I would like to know if the following is even possible with the visual studio.net Setup and Deployment project. 1. During the deployment after creation of application directory the setup needs...
4
by: esha | last post by:
I have ASP.NET 2 hosting. I created my first simple WEB application from Personal WEB Starter Kit template. Everything works fine on my local machine. I uploaded all files to the hosting server....
4
by: Zany | last post by:
I added a Web Deployment Project so I can create a debug, staging, and release version. Each set is compiled and saved in a separate folder under the csproj_deploy folder. All works fine. Here's...
1
by: Brad Isaacs | last post by:
I am working with ASP.NET 2.0 and using an SQL Server 2000 database. I am using Visual Studio 2005 and developing on my Local machine. I am working with Login controls ASP.Configuration, I...
2
by: Doug | last post by:
Hi I am ready to deploy my app to some testers who have agreed to do some beta testing. I have some questions that I would like some advice on please. Some of the people who will use my...
0
by: =?Utf-8?B?VCFN?= | last post by:
Hi All, I've been successfully deploying clickOnce successfully through the 2.0 and 3.X frameworks, but now have a problem with ClickOnce updates in 3.5 SP1. The scenario is this: I want to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.