locked
Self contained data for a C# application. Connecting to data with a DataGridView. (.csv, Access data base or SQL Server?)

    Question

  • So at this point I am aware that the DataGridView has a dataSource property and that the property can be set to connect to data. At this point I am very lost as to what type of connection I should actually be using. My application is a simple alarm clock and the DataGridView will only need to be capable of holding approximately ten rows of data at a time with five columns. At first I thought to myself hmmmmm..... perhaps I could create an Access database file and use that. Alternatively I think that perhaps using a .csv may end up with a cleaner solution. I am also thinking at this point that an actually SQL server connection will just make my application overly complex and feel as though that would be like the proverbial jet engine where only the electric cart is needed. What I do want to have is self containment. In other words I would like the data to be stored to disk but as integrated with the application as I can make it (.csv?).

    Suggestions?

    Thank you!

    Wednesday, August 01, 2012 6:58 PM

Answers

  • You can try using serializing the Dataset to XML and deserialize the dataset before u bind the data to the grid.  So you will be using DataSet.ReadXML() and DataSet.WriteXML(). I prefer u will have more control on data in XML format than CSV format

    See the sample in the MSDN page


    --Krishna

    • Marked as answer by S.e.p.y Wednesday, August 01, 2012 9:24 PM
    Wednesday, August 01, 2012 7:32 PM

All replies

  • You can try using serializing the Dataset to XML and deserialize the dataset before u bind the data to the grid.  So you will be using DataSet.ReadXML() and DataSet.WriteXML(). I prefer u will have more control on data in XML format than CSV format

    See the sample in the MSDN page


    --Krishna

    • Marked as answer by S.e.p.y Wednesday, August 01, 2012 9:24 PM
    Wednesday, August 01, 2012 7:32 PM
  • I had to think about it for a little while. I see how the data grid view could be used quite easily for such a purpose. Thank you Krishnav, I like the answer.
    Wednesday, August 01, 2012 9:23 PM