Hello,
How to set a particular database in a offline/online mode from C#
Thanks
Printable View
Hello,
How to set a particular database in a offline/online mode from C#
Thanks
Quote:
Originally Posted by sureshvijayan
I got the answer :
sqlCreateDBQuery = "ALTER DATABASE databasename SET OFFLINE";
sqlCreateDBQuery = "ALTER DATABASE databasename SET ONLINE";
I have another question ? from VB.NET/C# how could we know a database if offline or online mode ?
What database are you using?
SQL SERVER 2005Quote:
Originally Posted by Hack
I have a new problem ... i am able to give database offline by checking it is online or offline from C#..... no my problem ... if i set database offline ... i am not getting that db's name in select query for making it to online
SqlCommand sCom = sCon.CreateCommand();
sCom.CommandText = "sp_databases";
sCom.CommandType = CommandType.StoredProcedure;
SqlDataAdapter sqlAdapter = new SqlDataAdapter();
sqlAdapter.SelectCommand = sCom;
DataSet ds = new DataSet();
how to get the db's which is in offline ...