CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2010
    Posts
    17

    Create Data base SnapShots with our own file formats

    Hi All,

    We want to create a c#/VC++ application by using which we should be able to create sql server database SNAPSHOTs in our own file format (in online manner).

    And later we should be able to get data from those snapshots files in offline manner using our application ( i.e. we should be able to get number/names of tables/columns...etc details).

    Does anybody know how to do that?

    Thanks

  2. #2
    Join Date
    Nov 2002
    Location
    .NET 3.5 VS2008
    Posts
    1,039

    Re: Create Data base SnapShots with our own file formats

    I suggest you let Sql Server do what it does best. So all your application should do is execute the query to generate the snapshot in the format that Sql Server normally uses. You can then use your application to execute another query to restore the database based on that snapshot. You can also have a look at Sql Server Management Objects (SMO). I don't think they support creating snapshots but they may have other things that might be useful to you.

  3. #3
    Join Date
    Jan 2010
    Posts
    17

    Smile Re: Create Data base SnapShots with our own file formats

    Thank you for your reply.
    But our requirement is different we want to do it offline. i.e. in the offline manner we want to get table & columns from snap shot files. So as some other softwares like 'Red Gate' does we want to create snap shot with our application, which later can be read by using our software only.

  4. #4
    Join Date
    Jun 2001
    Location
    Melbourne/Aus (C# .Net 4.0)
    Posts
    686

    Re: Create Data base SnapShots with our own file formats

    There are some 'system' stored procedures within SQL Server. In the query analyser try:

    EXECUTE sp_tables (also sp_columns etc). You should be able to go from there and work out what you want.

    As far as the C# bit, in the designer, you can drag those stored procedures onto a Dataset's design surface and then use the functions within the System.Data namespace to obtain recordsets containing all of your tables and all of your columns. You can then write them to disk (or wherever) in your own format using the functions within the System.IO namespace or alternatively use the dataset's built in WriteXml(...) method.
    Rob
    -
    Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......

Tags for this Thread

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

Featured