954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Embedding a Database (VB + Microsoft Access)

Hello
I am having some trouble here, I created a Microsoft Access dataset (.accdb)
It is being used with some listboxes, comboboxes etc. The problem is when I publish the whole thing the datasets do not publish along with it and my program opens but there are not values. Anyone have any idea to allow the .accdb file to publish as a resource or something. Thanks

horsetamer
Newbie Poster
4 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

Better way to say it I know how to make the program direct to it but I need the database to publish along with the program.

horsetamer
Newbie Poster
4 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

I still have no idea what you're saying. And I can read between the lines.

hkdani
Posting Pro in Training
435 posts since Nov 2007
Reputation Points: 49
Solved Threads: 47
 
I still have no idea what you're saying. And I can read between the lines.

Ok So let me explain, I have visual Studio 2010 I am using visual basic to create a program which calls data from a Microsoft Access file (a type of spreadsheet/datasheet .accdb files)

My program works and has no flaws in debug mode, the problem is say I wan't a friend to use it, I tried publishing the program it made a click once set-up and everything then I launch it, it gives an error saying it cant find the .accdb file. I need help making the installer calling to the access file. Or is there another type of data spreadsheet i can use?

horsetamer
Newbie Poster
4 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

You need to use standard locations for your database location when you publish your program: use the Application Data Folder; e.g. Application Data\Program Name\MYdata.accdb.

Look up Virtual Folder Names in MSDN. The Application Data folder is a virtual folder. So as long as you are using virtual folders, they will install in the same place on any machine. And when you make calls to access the database, make sure that you use the appropriate function to find that virtual folder.

The Application Data Folder is the folder recommended by Microsoft to store your application's data. Use the following format: Application Data\Program Name\MyDatabase.accdb

The problem is not your database engine. The problem is writing code that will be universal on a PC using the Windows Operating System. Also you're in a VB6 forum and you are using VB.NET (Visual Studio 2010).

I realize the word publish can be used to describe the installation process; but it has several different meanings in programming. Just use the word install: e.g. I'm having problems installing my program.

hkdani
Posting Pro in Training
435 posts since Nov 2007
Reputation Points: 49
Solved Threads: 47
 

Thanks for all the help I understand I have to make it publish to Application Data, the problem is I don't know where I would go to get that done.

horsetamer
Newbie Poster
4 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
 

Personally, I would use the following method to save and locate your database:Find the Application Data folder
Save the location of your folder in the registry.
Use the saved value in the registry to locate your data.
Dim strDataLocation as String
strDataLocation = Environ("APPDATA") & "\My Program Name\MyData.mdb"

SaveSetting "My Program Name", "StartUp", strDataLocation

' Use this type of code or similar to save a public value for strDataLocation. And use that value for this variable repeatedly throughout your program to locate or save your data.

hkdani
Posting Pro in Training
435 posts since Nov 2007
Reputation Points: 49
Solved Threads: 47
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: