Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I remember writing like 1000 lines of code to create an Access database in vb6. It sucked.

 

I've also seen a method of the dataset is WriteXML, which writes the entire dataset structure to XML.

 

Is there a way to write to Access or another Database?

 

Not even for the data so much as the datastructure. I think that would be swell for errors when a database goes "poof". You can at least start over again.

Posted

From DataSet

 

Could have origionated from nothing (you just made it up on the fly), Access, XML or SQL Server.

 

I'm assuming that you have relations and tablenames, columnnames, properties filled out.

 

To: Anything

 

I know XML is possible.

 

Access, Oracle, SQL Server

 

Done in .Net via programming, not an external application (like MS Access, Oracle, SQL Server, etc)

  • *Experts*
Posted

I don't think there's anything in the standard .NET libraries for creating tables, regardless of the "source". For most databases you can execute a "CREATE TABLE ..." statement to create a table. I don't think there's anything available to do this for you.

 

I'm SURE there are tools that do this for you - create a database from a Dataset. If you want to write it yourself and you know that your DataSets are "clean" then it wouldn't be too hard. You can easily loop through tables, relationships, and columns in a dataset and create these "CREATE TABLE..." statements yourself. By "clean" I'm referring to the fact that a DataSet may have different datatypes than your Database so you'll have to make some assumptions (fine for you, maybe not Ok if this is a more general purpose chunk of code).

 

If your purpose is to rebuild a database, I'd wonder why you wouldn't have a backup? Seems much easier to backup an Access database (one file) or a SQL Server (2 files generally) then to backup a DataSet and have to restore from the DataSet.

 

Plus, a "real" backup would save Queries/Stored Procedures and other niceties.

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...