C Board  

Go Back   C Board > General Programming Boards > C# Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 07-28-2008, 12:06 AM   #1
System Novice
 
siavoshkc's Avatar
 
Join Date: Jan 2006
Location: Tehran
Posts: 1,075
Database

After making a DataSet and TableAdapter for my access or SQL database file. Where should we place the address of database file. Currently my program works only if database file is in exe folder. What if it is not local?
__________________
Microsoft Visual Studio 2008 Professional (On Microsoft Windows XP SP2)

Learn the language before using it. (C++ Books and C Books)
Read the FAQ before making a problem.
Then make a Google and Forum search.

My code painter new version Version 0.97 DOWNLOAD NOW! (Let the pop up, pop!)

SiavoshKC
siavoshkc is offline   Reply With Quote
Old 07-28-2008, 06:25 AM   #2
Ethernal Noob
 
Join Date: Nov 2001
Posts: 1,891
perhaps you can add the file as a resource, or integrate a file dialog or something to load the file.
__________________
Here to Deceive, Inveigle, Obfuscate Since 1945
indigo0086 is offline   Reply With Quote
Old 07-28-2008, 06:53 AM   #3
the hat of redundancy hat
 
nvoigt's Avatar
 
Join Date: Aug 2001
Location: Hannover, Germany
Posts: 2,769
I guess this is a perfect example for a config file.

Real short example : http://www.ajaxline.com/node/258

Short example: http://www.ezzylearning.com/tutorial.aspx?tid=8067328
__________________
hth
-nv

She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

When in doubt, read the FAQ.
Then ask a smart question.
nvoigt is offline   Reply With Quote
Old 07-28-2008, 07:55 AM   #4
System Novice
 
siavoshkc's Avatar
 
Join Date: Jan 2006
Location: Tehran
Posts: 1,075
All of the writings in config files and cs files about data access (database, dataset, datatable) are done by VS designer. There it puts a "|DataDirectory|" in connection string. In run time this phrase will be mapped to working directory instead of my database file directory.

I should not change the designer-generated code. But I did and replaced "|DataDirectory|" by my database file path. Now program works correctly. But there should be another way to tell the designer to do so, I think!
__________________
Microsoft Visual Studio 2008 Professional (On Microsoft Windows XP SP2)

Learn the language before using it. (C++ Books and C Books)
Read the FAQ before making a problem.
Then make a Google and Forum search.

My code painter new version Version 0.97 DOWNLOAD NOW! (Let the pop up, pop!)

SiavoshKC
siavoshkc is offline   Reply With Quote
Old 08-03-2008, 03:54 AM   #5
System Novice
 
siavoshkc's Avatar
 
Join Date: Jan 2006
Location: Tehran
Posts: 1,075
From a thred in MSDN forum. I learned:
-DataDirectory is a property of ApplicationDeployment in System.Deployment.Application NameSpace. But with only get accessor.
-We should set it when the program starts with
Code:
AppDomain.CurrentDomain.SetData("DataDirectory", @"C:\DatabasePath...");
I don't know why it is not documented in MSDN or maybe I just can't find it.
__________________
Microsoft Visual Studio 2008 Professional (On Microsoft Windows XP SP2)

Learn the language before using it. (C++ Books and C Books)
Read the FAQ before making a problem.
Then make a Google and Forum search.

My code painter new version Version 0.97 DOWNLOAD NOW! (Let the pop up, pop!)

SiavoshKC
siavoshkc is offline   Reply With Quote
Reply

Tags
dataset, tableadapter

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
literature database: help with planning officedog C++ Programming 1 01-23-2009 12:34 PM
Creating a database Shamino Game Programming 19 06-10-2007 01:09 PM
Struct with a ptr to a dynamically allocated array of other structures :( michael- C Programming 10 05-18-2006 11:23 PM
Developing database management software jdm C++ Programming 4 06-15-2004 04:06 PM
Making a Simple Database System Speedy5 C++ Programming 1 03-14-2003 10:17 PM


All times are GMT -6. The time now is 11:02 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22