1
Are you still stuck somewhere? Is given direction not sufficient? If so, please give precise area where you are not clear so that more details can be given.
Please provide maximum information and don't assume anything anything.
1
Hi Guddu,
Please follow below link.
https://support.microsoft.com/en-us/kb/307283
0
Hi
Please check the link
http://www.codeproject.com/Articles/10213/Create-an-SQL-Server-Database-Using-Csharp
https://support.microsoft.com/en-in/kb/307283
0
Rajiv Sir This is my Problem
i develop small software for my shop trading shop
i created dbconnection() class some code need as below
if i have 3 db file db1415, db1516, db1617
then application run in db1617 from d:\data\db1617.mdf on location
all table copy from old to new one
0
nitin sir. thanx for reply.
rajiv thx for reply
0
rajiv, I already read microsoft link . but i need incremented from textbox.
0
I strongly suggest that do not include any special character (such has -, i.e. hyphen) in the name, it will be a headache later. Instead keep db name (also, table names, column names, etc.) simple. To give the effect of space, use _ underscore instead.
So your db name becomes db20152016, etc. Then again what is "db"? It doesn't tell anything about "function" or "business". So if this is Financial Year, call it FY20152016, etc.
Now to answer your question, all you have to do is construct a string of a SQL and fire it against a connection, by default keeping the master as your database.
For example, something as follows:
DateTime YearStart, YearEnd; // Assign appropriate values to these variables.
String query = "create database FY" + YearStart.Year.ToString() + YearEnd.Year.ToString() + ";" // add more script here if required.
I also suggest that you keep all your master tables in separate db and keep an entry of each such created db in master tables db, so that it can be used to show the drop down of years.
