You are on page 1of 2

SANJEET-PC\\SQLEXPRESS //private bool IsMsSQLServerDbExists() //{ // bool bIsDbExists=false; // DatabaseCore databaseCore = m_dbFactory.CreateDatabaseCore(m_proje ctDef.

Database); // SqlConnection conn = new SqlConnection(); // conn.ConnectionString="Data Source=SANJEET-PC\\SQLEXPRESS;Integrat ed Security=True"; // SqlCommand cmd = conn.CreateCommand(); // // // ; // // // // // // //} //private void CreateMsSQLDataBase() //{ // DatabaseCore databaseCore = m_dbFactory.CreateDatabaseCore(m_proje ctDef.Database); // SqlConnection conn = new SqlConnection(); // conn.ConnectionString = "Data Source=SANJEET-PC\\SQLEXPRESS;Integr ated Security=True"; // // // if (conn.State == ConnectionState.Closed) conn.Open(); SqlCommand cmd = conn.CreateCommand(); cmd.CommandText = sQuery; SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) bIsDbExists=true; conn.Close(); return bIsDbExists; if(conn.State== ConnectionState.Closed) conn.Open(); string sQuery = "SELECT name FROM sys.databases where name='Data'"

// string sqlCreateDBQuery =" CREATE DATABASE Data ON PRIMARY (NAME = TestDB_Data, FILENAME = 'C:\\Dinesh Wagh\\TestDB_Data.mdf', SIZE = 2MB, FILEGROWTH =10%) LOG ON (NAME =TestDB_Log, FILENAME = 'C:\\Dinesh Wagh\\TestDB _Log.ldf', SIZE = 1MB, FILEGROWTH =15) "; // " ON PRIMARY // // ', " // // ") " // ", " // , " //sqlCreateDBQuery = " CREATE DATABASE " + DBParam.DatabaseName + " // // // // // // + " (NAME = " + DBParam.DataFileName + ", " + " FILENAME = '" + DBParam.DataPathName + " + " SIZE = 2MB," + " FILEGROWTH =" + DBParam.DataFileGrowth + + " LOG ON (NAME =" + DBParam.LogFileName + + " FILENAME = '" + DBParam.LogPathName + "'

// // ") "; // // // //}

// //

+ " SIZE = 1MB, " + " FILEGROWTH =" + DBParam.LogFileGrowth +

cmd.CommandText= sqlCreateDBQuery; cmd.ExecuteNonQuery(); conn.Close();

You might also like