473,324 Members | 2,268 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,324 software developers and data experts.

VB.net - How to install it with other files

Hi

I would appreciate if someone could point me in the right direction.

I'm developing a small application which includes MS Access database in it.


When someone install it I need to know where the database was installed so I can update the connection string. Currently I use OnceClick VB 2008 feature and it doesn't alow me to specify the folder.

On Vista PC I have also some issues with the Access database if it is in C drive directly or Program Files folder it becames read-only and I cannot update/insert any records.


Many thanks in advance.
Emil
Jan 2 '09 #1
3 1201
lotus18
866 512MB
@emsik1001
Hi

The simplest way on how to do it is using Application.StartupPath as your connection path for your access database.

Something like

Expand|Select|Wrap|Line Numbers
  1. Imports System.Data.OleDb
  2.  
  3. Public conn As System.Data.OleDb.OleDbConnection
  4.  
  5. Public Sub SetConnection()
  6. conn=New System.Data.OleDb.OleDbConnection()
  7.         Try
  8.             conn.ConnectionString = ("Provider=Microsoft.Jet.OLEDB.4.0;" & _
  9.             "Data Source=" & Application.StartupPath & "\Database\MyDatabase.mdb;" & _
  10.             "Persist Security Info=False;Jet OLEDB:Database Password=password")
  11.             conn.Open()
  12.         Catch ex As Exception
  13.             MessageBox.Show(ex.Message, "Connection Failed", MessageBoxButtons.OK, MessageBoxIcon.Error)
  14.             conn.Close
  15. conn.Dispose
  16.         End Try

Rey Sean
Jan 3 '09 #2
Thanks that is what I was exactly looking for!!
Jan 3 '09 #3
Just an update

I have used this property to get the path but unfortunately my dataset has been using a different path.

After reading some forums I changed publish status to data file and used this property Application.UserAppDataPath to get the path and now my updates and dataset are synchronized.

Regards
Emil
Jan 3 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Craig D | last post by:
I got really tired of unpacking a distutils package, installing then cleaning up. So I wrote distinstall.py - it reads a zip file, unpacks it, installs the bits and cleans up. I've only used it on...
13
by: cab0san | last post by:
I downloaded the DB2 runtime client, but the Client Base support and the TCP protocol do not install. I re-run the setup select them to run from disk, and they still show as not installed. What am...
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
1
by: Lori | last post by:
I created an install for my program. During installation, 3 User Interface dialogs display asking for values that will be stored in the registry. I'm not registering anything, just storing values...
3
by: Olav | last post by:
Hi all, I can not install CF 2.0 SP 1 on an Symbol PPT8800 running WinCE 4.2. The Install-Log say's cgacutil.exe failed with exit-code 80000004 and I get a messagebox indicating a support-Info...
5
by: Ajith Menon | last post by:
I have to install .NET framework 3.0. I already have .NET Framework 1.1 installed on my machine. I don't want to remove framework 1.1 since some of the critical applications are using it. While...
3
by: Anthony Smith | last post by:
I always get this message. No matter what package $ pear install Date PHP Warning: Module 'oci8' already loaded in Unknown on line 0 No releases available for package "pear.php.net/Date"...
1
by: kataoki | last post by:
Hi, This is the log file for my SP1 on 2005 install. Can anyone please look at this and tell me if this looks normal? I'm concerned about the following in the log: "Failed to read registry...
4
by: Amber | last post by:
The installer tells it faild to config db2inst1, the db2setup.err is as following: /usr/share/themes/Clearlooks/gtk-2.0/gtkrc:60: Engine "clearlooks" is unsupporte d, ignoring Jun 15, 2007...
0
by: Office97User | last post by:
In reply to the thread at http://www.thescripts.com/forum/thread622173.html . I have a slightly modified version of the steps involved that worked on my computer. 1. Install Office 97, but...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.