Click here to Skip to main content
15,890,336 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi all,

I have browse information from many source in this forum and found out many information which is very useful. However I still having a problem.

What I intend to do now, link the MS Acess my with program and publish it (Use it like installer in other computer).
My problem:-
1. Should I Changed my .xsd file like I changed my ,mdb file with regards to Buildaction & copytodirectory output?
2. After I publish to project, where can I find my database location? I have tried doing this but surprisingly I found 2 different folder for my program installed. one for my .mdb file and second one to store my txt file, folder for other file, cursor image etc. Is it suppose to be like this? or should it be combined?

I really hope can guide me on this.

Thank you in advanced.
Posted
Updated 21-Feb-11 3:59am
v2
Comments
Kschuler 21-Feb-11 11:22am    
Could you please provide more information about how you are deploying your project. Are you using a Setup Project to create a setup.exe or are you using ClickOnce or a third party deployer?

Hi Kschuler,

I declare this
Dim con As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\u-surfdb.mdb;")


Then I add new data source from the path contains my .mdb file. Later on I changed my database Buildaction = content copytodirectory output = copy if newer. Then I will perform publish (From project).

I choose a folder from my desktop (To put the installer and others application related). I then Run the setup from that folder to install in my computer.

Having said that, When I try to detect the location of my database and other file, I found 2 paths.

1. this path contains my database .mdb only
C:\Documents and Settings\newuser\Local Settings\Apps\2.0\Z8EWEQ8D.702\E1QZ0N3Z.7V8\u-su...exe_2cb43422b8a531ac_0001.0000_none_7e52a763d3e1d911


2. This path contains my .txt file, folder capture image, icons image etc
C:\Documents and Settings\newuser\Local Settings\Apps\2.0\Z8EWEQ8D.702\E1QZ0N3Z.7V8\u-su..tion_2cb43422b8a531ac_0001.0000_f44641152bf939f9

P/S this program is capturing notification image. After user capture the image they will have to answer some questions with regards to the image captured.

The problem start to occurs when I check the database, there is no data at all.

I hope this info helps you.
 
Share this answer
 
Comments
zafi24 21-Feb-11 11:38am    
I am thinking this is click once. Please correct me if I am wrong.
Yes. Using ClickOnce when you publish your app it will put your database in the Local Settings\Apps\2.0 and then generate a randomly named folder which will be different on each machine. To access this location in code you can use this:
VB
Dim strDatabaseLocation As String = My.Computer.FileSystem.SpecialDirectories.CurrentUserApplicationData & System.IO.Path.DirectorySeparatorChar & strYourDataBaseName


The problem you are encountering with the data has to do with how ClickOnce works...depending upon the properties (Build Action, Copy to Directory, etc...) it will treat the database file differently when it's installed or a new version is published. If the database has changed it may overwrite the data on the user's machine. You'll want to do some research on ClickOnce[^] to learn more about these settings. And in case you haven't tried it, google[^] has some links that may help you.
 
Share this answer
 
v2
Comments
zafi24 21-Feb-11 15:08pm    
Hi Kschuler,

I am sorry for not replying using this comment. I am new in this forum. Sorry again for that.

What I mean database is not working, After I publish the program, I run it there is no data in the database captured albeit the message stated that it is successfully saved. ( it's working well in development).

That is why I am asking whether I have determined a correct path of my database or not. Because no error message op up whilst using my program. I have changed copytodirectory = copyif newer and set build action = content but still not working.

Im not sure where it went wrong. What i reckon based on the 2 paths that I have mentioned above, the database folder is separately with a folder contains others (txt file, cursor image, logo image, icons image etc).

Or do i forgot to so something before I publish?

Please... I really need help on this.
Kschuler 21-Feb-11 15:31pm    
There are many ways to accomplish what you are asking. The way that I've done it is to set the access database build action as content, like you said. Then when publishing I make sure that in the Application Files screen my database is listed with a publish status of Data File. This makes sure it gets copied to the CurrentUserApplicationData special folder, accesible as I showed you above. So you would use that in your connection string. You need to make sure that the data you want the user to have right away is in the database that is listed in your solution explorer. (You might debug with a different copy of the DB, so make sure they are both setup with the data). You need to know, also, that if you publish it this way, then make any changes to the database and publish another version, the user will lose any changes to their copy of the database. You will have to write code to move data from a previous publish version to the new one. And just to be sure you realize, when you publish the db you are giving each individual use their own copy of the db. Is that what you are looking for?
zafi24 22-Feb-11 6:52am    
Hi
Another thing I would like to ask, is it possible to change the way how the data published being install in computer. As far as I am concern, currently after publish all data with regards to the program will be install in this path C:\Documents and Settings\newuser\Local Settings\Apps\2.0

Is it possible to change it using one touch? or any other method?

Thank you friend
Kschuler 22-Feb-11 9:23am    
I don't believe you can change where it gets installed with ClickOnce. If you want to be able to change these things you could look into creating a Setup Project in Visual Studio. You can find a lot of articles about how to do that in CodeProject or Google.
zafi24 22-Feb-11 10:14am    
Hi Kschuler,

Ok. I understand that now. Anything I would like to ask When I publish my project, I have to insert manually certain file and folder(.txt file, a folder(to store image), icon .ico etc). Why this items not directly installed after it's being published?

I have read some articles about resources tab in (My project). Just wondering Can I just simply add it all this in there? Should I declare anything in the codes? I don't have experience on using this.
Hi Kschuler,

I have followed this http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/8ead4f51-b681-4812-a763-a56f3f66b488

I have changed the content, copy to directory ... But when it publish, the database is not working. Having said that I have try to get more information from many source. One of it I ask expert in forum. Seriously I don't know what to do next. Do you have any thoughts?

Thank you
 
Share this answer
 
Comments
Kschuler 21-Feb-11 13:42pm    
First of all...you need to Add Comment to the reponse of the person you are asking a question. I don't get an email nofiying my of your question when you use the Add an Answer button. Second, could you explain what you mean by the database is not working? What error message are you getting?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900