Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi, I'm creating a small billing software. I want to store data to selected location.Now i am using folder browser dialog to select the location but i don't know to create a database for per year using mdf file. Plz help me....

What I have tried:

Create a year database to user selected location.
Posted
Updated 13-Jun-16 20:14pm
v2
Comments
George Jonsson 14-Jun-16 1:59am    
Not really clear what it is you want to do.
Do you have a database already? Mentioning an .mdf file indicates you are using SQL server in some way.
And why do you need a database per year for a small amount of data?
BillWoodruff 14-Jun-16 2:09am    
why are you using MDF files (Mirror Disc Files), a very odd format.

1 solution

It really depends on what kind of database you are using.
You say MDF files, which are normally SQL Server, and you shouldn't try to "create" them yourself, nor should you be involved in where they are stored - that is all up to SQL Server itself. If you do create them in a specific location, there is a very, very good chance that they won't work in production as Attaching a DB file to SQL only works on the localhost EXpress editions, and that isn't what you use outside development.
Instead, let SQL server take care of where it's stored by using the appropriate CREATE DATABASE SQL statement, followed by the CREATE TABLE and so forth: SQL CREATE DATABASE Statement[^]
 
Share this answer
 
Comments
Member 11830380 14-Jun-16 2:46am    
Thank You... This solution give an idea to create database to decided location.
OriginalGriff 14-Jun-16 3:08am    
You're welcome!

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