Question VC# 2008 express not giving option to copy database file to local when xna 3.1 projec

henkm

New member
Joined
Jun 28, 2012
Messages
2
Programming Experience
10+
Hi
I am building an XNA 3.1 project in C# 2008 express.
The program is modified to open winforms, as it's a school application and offers lessons. Some of the lessons will be a little game (hence the XNA part).
The games are opened from the forms, in a new thread, and returns control to the form after the thread finishes.

Problem is that I store info for the students in an Access 2007 database file, which I added to the project using the "Add new data source" link.
If it's a normal winforms project, VS gives you the option to copy the file from the directory where it lies into the local project, and then it is part of the project. (LOCAL vs remote database).

Unfortunately, Microsoft thought it best to make this as difficult as possible when coding an XNA project, even if you CAN add winforms to your project.
Instead of just keeping the same functionality when you add a data source, it now only creates a schema for you, and still refer to the file in it's original position.
So obviously when I take my program to my workplace, the program crashes when I try to run it in debug mode, as it cannot find the file in the remote location. (which is my PC at home, of course)

How can I manually "force" the file to be part of the project?

This may be easy for you to solve, but the more I read up on .NET, VS and XNA, the more confused I become, LOL!

Please assist me!
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,137
Location
Sydney, Australia
Programming Experience
10+
If you want the Access data file to be part of your project then why not simply add it to your project yourself before creating the Data Source. You do that in exactly the same way as you would for any other file.
 

henkm

New member
Joined
Jun 28, 2012
Messages
2
Programming Experience
10+
Thanks jmcilhinney, I got it to work by adding it to the project, and by modifying the connection string to look inside the project (the connection string looks exactly the same as my other project which automatically included it.)
It seems to work now, I'm from a legacy background, so need to get used to all this .NET stuff...... :)
 

annaharris

Member
Joined
May 8, 2013
Messages
13
Programming Experience
1-3
Thanks Jmcilhinney, I have added the Access data file within my project but still it's not working.
 
Top Bottom