how to create .mdf file
-
hi all, i want to know how to create .mdf file under my App_data in my application. can any one guide me how to achieve this???????
-
hi all, i want to know how to create .mdf file under my App_data in my application. can any one guide me how to achieve this???????
Hi, here is ur soln:-D:-D:-D u have a to add a Com Reference for IT :cool: Microsoft ADO Ext. 2.8 for DDL and Security Reference > right Click > COM Tab Select that on !!!!!!! :cool: Now , use that code Using ADOX; private void Form1_Load(object sender, EventArgs e) { ADOX.CatalogClass mYcat = new ADOX.CatalogClass(); mYcat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=D:\\NewMDB1.mdb;" + "Jet OLEDB:Engine Type=5"); MessageBox.Show ("Database Created Successfully"); mYcat = null; } yup.... Done !!!!! :) :) :) :) :) :cool:
Happy Programming ----- Abhijit
-
hi all, i want to know how to create .mdf file under my App_data in my application. can any one guide me how to achieve this???????
SqlConnection myConn = new SqlConnection("Server=" + servername + " ;Integrated security=SSPI;database=master"); str = "CREATE DATABASE " + Database name + " ON PRIMARY " + "(NAME = MyDatabase_Data, " + mdf_filename + //"FILENAME = 'C:\\MyDatabaseData.mdf', " + "SIZE = 2MB, MAXSIZE = 10MB, FILEGROWTH = 10%) " + "LOG ON (NAME = MyDatabase_Log, " + ldf_filename + //"FILENAME = 'C:\\MyDatabaseLog.ldf', " + "SIZE = 1MB, " + "MAXSIZE = 5MB, " + "FILEGROWTH = 10%)"; SqlCommand myCommand = new SqlCommand(str, myConn); myConn.Open(); myCommand.ExecuteNonQuery(); It will create database as well ur mdf file ....... :)
Happy Programming ----- Abhijit
-
Hi, here is ur soln:-D:-D:-D u have a to add a Com Reference for IT :cool: Microsoft ADO Ext. 2.8 for DDL and Security Reference > right Click > COM Tab Select that on !!!!!!! :cool: Now , use that code Using ADOX; private void Form1_Load(object sender, EventArgs e) { ADOX.CatalogClass mYcat = new ADOX.CatalogClass(); mYcat.Create("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=D:\\NewMDB1.mdb;" + "Jet OLEDB:Engine Type=5"); MessageBox.Show ("Database Created Successfully"); mYcat = null; } yup.... Done !!!!! :) :) :) :) :) :cool:
Happy Programming ----- Abhijit
Hi Abhijit, i want to know how to copy my tables, stored procedures from one file to another file. can you guide me wat to do..
-
Hi Abhijit, i want to know how to copy my tables, stored procedures from one file to another file. can you guide me wat to do..
i belive you want to copy some table from one database to another one !!!! please confirm me !!!! u can use this link also !!! :cool: http://www.codeproject.com/cs/database/GenericCopyTableDataFcn.asp[^]
Happy Programming ----- Abhijit
-
i belive you want to copy some table from one database to another one !!!! please confirm me !!!! u can use this link also !!! :cool: http://www.codeproject.com/cs/database/GenericCopyTableDataFcn.asp[^]
Happy Programming ----- Abhijit
yup.. i want to transfer all my tables and stored procedures from one database to another database.
-
yup.. i want to transfer all my tables and stored procedures from one database to another database.
http://www.codeproject.com/useritems/SqlBulkCopy_in_ADONET.asp?df=100&forumid=466499&exp=0&select=2252069[^] please try this one !!!! :)
Happy Programming ----- Abhijit
-
http://www.codeproject.com/useritems/SqlBulkCopy_in_ADONET.asp?df=100&forumid=466499&exp=0&select=2252069[^] please try this one !!!! :)
Happy Programming ----- Abhijit
cant we move directly means by writing script or some thing like that.. instead of writing code for this?
-
cant we move directly means by writing script or some thing like that.. instead of writing code for this?
if you want to move directly table and all other things.... u can use either copy option or import option in SQL Server!!!! it will copy all table and procedure to a new table !!!!
Happy Programming ----- Abhijit