Creating a DATABASE programmatically


i creating database following code

 

myconn = new sqlconnection("data source=.\\sqlexpress;attachdbfilename=c:\\users\\nishant\\desktop\\systemdatabase\\systemdatabase\\app_data\\database1.mdf;integrated security=true;user instance=true");

            sqlcommand cmd = new sqlcommand();

            cmd.connection = myconn;

            cmd.commandtext = "create database "+textbox1.text;

            myconn.open();

            cmd.executenonquery();

            myconn.close();

but not able find database created. have chked out folders specially microsoft sql server folder
please reply asap

 


nalin taneja


hi nilin,

based on description, mean want create database programmatically?

if so, can refer folowing links:
http://www.codeproject.com/kb/tips/createsqldv.aspx
http://support.microsoft.com/kb/307283
http://support.microsoft.com/kb/305079


vin jin [msft]
msdn community support | feedback us
get or request code sample microsoft
please remember mark replies answers if , unmark them if provide no help.



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'