Results 1 to 4 of 4

Thread: setting datatabase offline/online using C#

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2002
    Location
    fgh
    Posts
    332

    setting datatabase offline/online using C#

    Hello,

    How to set a particular database in a offline/online mode from C#

    Thanks
    gh

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    May 2002
    Location
    fgh
    Posts
    332

    Re: setting datatabase offline/online using C#

    Quote Originally Posted by sureshvijayan
    Hello,

    How to set a particular database in a offline/online mode from C#

    Thanks


    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 ?
    gh

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: setting datatabase offline/online using C#

    What database are you using?

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    May 2002
    Location
    fgh
    Posts
    332

    Re: setting datatabase offline/online using C#

    Quote Originally Posted by Hack
    What database are you using?
    SQL SERVER 2005


    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 ...
    Last edited by sureshvijayan; Oct 11th, 2007 at 03:21 AM.
    gh

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width