store arraylist in database
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: store arraylist in database

  1. #1
    Join Date
    Jan 2009
    Posts
    22

    store arraylist in database

    I have an arraylist which has a list of structures stored in it
    Now i need to store these structures in a database, where each structure has its own line.

    public struct BackupSpecEntry
    {
    //for Multiple BACKUP_SPEC_EXCLUDE_PATHS
    public string path;
    public string inclExcl;
    public byte inclExclFlags;
    public bool indexContents;
    public int serverBackupSpecId;
    public int freq;
    public int retention;

    //for Multiple BACKUP_SPEC_EXCLUDE_FILE_NAMES

    public BackupSpecEntry(string Path, string InclExcl, byte InclExclFlags, bool IndexContents,
    int ServerBackupSpecId, int Freq, int Retention)
    {
    path = Path;
    inclExcl = InclExcl;
    inclExclFlags = InclExclFlags;
    indexContents = IndexContents;
    serverBackupSpecId = ServerBackupSpecId;
    freq = Freq;
    retention = Retention;
    }
    }


    My arraylist is ArrayList backupSpecList = new ArrayList();


    how to store this in a database....

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    11,289

    Re: store arraylist in database

    What database are you using? MS SQL? MySQL, Access? Are you using stored procedures?

  3. #3
    Join Date
    Oct 2009
    Posts
    2

    Re: store arraylist in database

    It's depends what you are looking for.
    You can store serialize object in your database. To make that, you can use Xmlserialize class

    Advantage :
    - Whatever the structures, the object can be store in the db

    Disadvantage :
    - You don't have any controle about the data integrity in the database
    - When your code change it'll require to make a script to change the format of data already stored (maintenance is heavy)
    - You can't use the SQL easily to make some search in the db

    This solution is very simple but I don't advise if your application'll change frequently or if your data'll be used by other softwares.

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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center