Results 1 to 4 of 4

Thread: Saving a Created DataBase (Not Solved, But found an alternative way)

  1. #1

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192

    Saving a Created DataBase (Not Solved, But found an alternative way)

    Alright, I am using ADO.Net... And so I created the DataBase with a lot of efforts... Good!

    But now.. How do I save it?

    Here is what I did:


    Code:
    this.oDs = new DataSet(DictionaryModule.myDB.Nombre);
    Console.WriteLine("DataBase:" + DictionaryModule.myDB.Nombre);
    DataTable oDtbl;
    DataColumn oDclm;
    
    foreach(DictionaryEntry myEntry in DictionaryModule.myDB){
    	Tabla tbl = DictionaryModule.myDB.Item(myEntry.Key.ToString());
    	Console.WriteLine("Table: " + tbl.Nombre);
    	oDtbl = new DataTable(tbl.Nombre);
    	foreach(string col in tbl.Columnas){
    		oDclm = new DataColumn(col);
    		Console.WriteLine("Column: " + col);
    		oDtbl.Columns.Add(oDclm);
    	}
    	this.oDs.Tables.Add(oDtbl);
    }
    			
    //Create DataBase
    System.IO.FileStream fileDB = new System.IO.FileStream(this.DBName + ".mdb", System.IO.FileMode.Create);
    //How do I save it? :(		
    fileDB.Close();
    this.oDs.Dispose();
    Last edited by Tec-Nico; May 28th, 2003 at 01:26 AM.
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  2. #2

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    Well, I still don't know how to write it into a file... But I know how to do it with XML...

    If it helps you, you can always do something like:


    Code:
    this.oDs.WriteXML(fileDB);
    And if you want to read it, just do it like this:

    Code:
    this.oDs.ReadXML(fileDB);
    But still I don't know how to do it like a mdb. (I already solved my problem using XML, but this is for future reference)
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  3. #3

  4. #4

    Thread Starter
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    Thanks, Pirate... I will check it.
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

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