locked
Flat File Database?

    Question

  • Hey!

     

    Is it possible to save data to a flat file and then retrieve it again later?

    just a simple flat file database...

    or maybe data.dat file  what ever a dat file is lol

    ty all

    -mark

    Friday, February 10, 2006 1:27 AM

Answers

  • If your data is in a DataTable or DataSet, you can use the WriteXml and ReadXml methods.

    Private Sub SaveData()
        ' Call in Form_Load

        DataTable1.ReadXml("Table1.xml")

    End Sub

    Private Sub LoadData()
        ' Call on FormClosing

        DataTable1.WriteXml("Table1.xml")

    End Sub

    Using the WriteXml and ReadXml on a DataSet, saves all the Tables in the Dataset to a single file.

     

    Saturday, February 11, 2006 5:23 PM

All replies

  • You an save data where-ever you like.  If you'd like a flat file, XML is probably the best way to go, for ease of searching, etc.  The XML Document class will load and save XML documents for you, as well as exposing the DOM.

     

    Friday, February 10, 2006 1:40 AM
  • so do i need to learn xml  or is there a quick fix of doing this

     

    ty cgraus

    Friday, February 10, 2006 2:33 AM
  • *grin*  well, you need to learn how XML works, as you would use XPath to search for information in your data.  A 'quick fix' for fixed data would be a plain text file, where your code knows what it reads and writes every time, or where the values are name/value pairs, like an ini file.  But, XML is more flexible, and more widely used.

     

    Friday, February 10, 2006 2:35 AM
  • ok so i need to learn a bit on xml ugh lol I searched google on info on how to create a little database using xml but no go just confusing mess lol

    thanks cgraus appreciate urr help

     

     

    Friday, February 10, 2006 2:40 AM
  • You're not really creating a database at all, that will pollute your search.

    Dim doc as XmlDocument = new XmlDocument

    doc.LoadXML("<xml><node>value</node></xml>")

    doc.Save("c:\doc.xml")

    doc.:Load("c:\doc.xml")

    this creates a document from a string, saves it to disc and reloads it.  YOu need the system.xml namespace to do this.  From there, the document object model ( DOM ) is a standard thing, the www website has good tutorials, and there's the MSDN help as well.

    http://www.w3schools.com/xml/default.asp

     

    Friday, February 10, 2006 2:43 AM
  • If your data is in a DataTable or DataSet, you can use the WriteXml and ReadXml methods.

    Private Sub SaveData()
        ' Call in Form_Load

        DataTable1.ReadXml("Table1.xml")

    End Sub

    Private Sub LoadData()
        ' Call on FormClosing

        DataTable1.WriteXml("Table1.xml")

    End Sub

    Using the WriteXml and ReadXml on a DataSet, saves all the Tables in the Dataset to a single file.

     

    Saturday, February 11, 2006 5:23 PM
  • Hi ,

    Yes, you can connect to  a flat DataBase like .DBF by using the ODBC please, check this url :

    http://www.codeproject.com/database/connectionstrings.asp

    note: I advice you to use the Microsoft SQL2005 Server if you design you programs for commercial use or use the flat database if you need to send to your friends a simple application:-)

    Good luck

    Thanx

    Saturday, February 11, 2006 8:05 PM
  • "note: I advice you to use the Microsoft SQL2005 Server (Express,I added this....) if you design you programs for commercial use or use the flat database if you need to send to your friends a simple application:-)"

    Why?

    Saturday, February 11, 2006 9:03 PM
  • hi, I'm an old developer from DOS environment. I used this files for many year and i faced a lot of problems with it.

    flat database is very old and you will face some of problems like :

    1. the large size of data and index files

    2. The database size limitation you will split your file like month01, month02 ,..etc

    3. the database is file on the physical Hard disk (it's a table too) you'll need to manage file names .

    4. you will get the limitation with data type  ...etc

    5. you must to have an old experience with this type of data bases.

    6. you will lose the powerful features like the data replication,Mirroring ...etc

    7. you must to do some of data compression to backup ur data like zip the file

    ..... etc

    in the another side

    the database is file consists of tables easy to manage , easy to backup , replication , data recovery , routable , security , stability ...etc

    why you need to walk back to the past ? you must to get the latest technology to build apowerful app.

    good luck

    thanx

    :--)

     

    Saturday, February 11, 2006 9:57 PM
  •  

    "note: I advice you to use the Microsoft SQL2005 Server (Express,I added this....) if you design you programs for commercial use or use the flat database if you need to send to your friends a simple application:-)"

    Why?

    You misunderstood the Why? Sorry you worked so hard to knock Down Flat Databases(which I totally Agree with You....)  Why would recommend SQL2005 Server Express for Commercial and not for your friends Applications.... Do you not like Your Friends...... Why not use SQL2005 Server Express for all Applications Friends or Commercial???????  Again Why? Cheers 

    Saturday, February 11, 2006 10:13 PM
  • exactly , you can use SQL2005 for both but you must to teach your friends the SQL installation.

    thanx

    Saturday, February 11, 2006 10:19 PM
  • "exactly , you can use SQL2005 for both but you must to teach your friends the SQL installation"

    This is a VBE Forum..... You MUST answer Posts in terms of VBE for Fairness and Accuracy.... You are WRONG.... One Click Deployment Downloads and installs all necessary files on the users System("Your Friends System")....... This is done Seamlessly.... Cheers

    Saturday, February 11, 2006 11:00 PM
  • Dear Bronco,

    I knew that we are using the VBE forum and I think that misunderstanding between me and you so let us talk as the professionals :

    I said before yes you can use SQL2005 for both and you made one objection why I said you must teach your friends the sql installation because the sql 2005 server express edition is the server platform needs some of requirements.

    you mentioned that one click deployment downloads and install all necessary files on the users system ( which system ? you must to know).

    you can run the setup now and see that you have many of steps to install the sql

    server 2005 express edition your friends must to know them.

    like : accept the agreement , System Configuration Checker (may fails) , registeration information , features ,  Instance ...etc

    you must to teach them or guide them by readme file about the installation or send us the installation guide or do any media file ....

    now I think you understand me..

    in ending we discuss about this point not fighting please follow this link for more information:

    http://msdn.microsoft.com/vstudio/express/support/sqlreadme/default.aspx#_3462_setup_issues_238p

    good luck.

     

     

    Sunday, February 12, 2006 10:21 PM
  • Hi SmSm241....I am not a current IT Professional..... I was pre OOP(long time ago)..... I didn't mean to Offend You but I still disagree with you.... Certainly SQL Server Express can be managed but doesn't have to be.... From my experience and reading the Documenatation of click one Deployment.... An App will Deploy and install on your friends Computer System with no further Management.... Click once and Go....  VBE is for beginners not for Pros.... Why would MS make the SQL Server Express the main Data Storage Tool if it were meant to be used only for Pro Deployment...... It makes no sense....  If you and others are discouraging Beginners to us SQL Server Express and MS wants the Beginners to Learn and use it... You are doing a major Disservice to the Beginners And MS..... I wish MS would jump in And resolve this Issue....   One of Us Is Terribly WRONG.... Cheers 

    Monday, February 13, 2006 12:35 AM
  • Dear Bronco,

    Sorry about misunderstanding between me and you. I think we put our hands on the problem. VBE and SQL Express editions for beginners , hobbyists, students if your friends going to learn the development. if we are talking with end users like your friends you must to guide them.

    in ending my word is the beginner must learn first because I guess that Microsoft faced many of problems from this point.

    I think we have not any problems now.

    good luck

    Thanx

     

     

    Tuesday, February 14, 2006 2:48 AM
  • What Ever You say Chief.... I don't really Care I will always use SQL Server Express for my Apps.... I don't have an Ego Problem... If my friends can't Handle SQL Server Express... I'll get New Friends.... How the Hell did you print beginner must learn first .... That's Cool Bold and Underlined.... Cheers
    Tuesday, February 14, 2006 3:54 AM