-
October 9th, 2009, 02:57 PM
#1
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....
-
October 9th, 2009, 05:05 PM
#2
Re: store arraylist in database
What database are you using? MS SQL? MySQL, Access? Are you using stored procedures?
-
October 11th, 2009, 04:33 AM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|