Which file type to use to save data...

  • Thread starter Thread starter alexia.bee
  • Start date Start date
A

alexia.bee

Hi all,

I am new to C# so please bear me :).

I have an app which uses datagridview. it has 8 columns.
I also have struct which has 8 members(the same as the datagridview).
when I add row to the gridview, i add the same data to this staruct and
then add this struct instance to a list.

the app creates more then one file with different name. depending on
the user.

I need to save all the list to a file. I also need to be able to copy
the content of this file and to present it in the grid view. there are
no rules for the read file. I always load the entire file to the list
and vice versa.

I was thinkking to use Access(mdb) or excell(xls) to save the content.
which one do you think i should use?

Thanks,
Alexia
 
Hi all,

I am new to C# so please bear me :).

I have an app which uses datagridview. it has 8 columns.
I also have struct which has 8 members(the same as the datagridview).
when I add row to the gridview, i add the same data to this staruct and
then add this struct instance to a list.

the app creates more then one file with different name. depending on
the user.

I need to save all the list to a file. I also need to be able to copy
the content of this file and to present it in the grid view. there are
no rules for the read file. I always load the entire file to the list
and vice versa.

I was thinkking to use Access(mdb) or excell(xls) to save the content.
which one do you think i should use?

Thanks,
Alexia

What about csv file(properly escaped), or xml/html(<table/>, <tr/> <td/>)
file if it is purely used as data repository at the backend?

Ryan
 
Ryan said:
What about csv file(properly escaped), or xml/html(<table/>, <tr/> <td/>)
file if it is purely used as data repository at the backend?

Ryan

Hi Ryan,

thanks for your reply,

I was thinking to write to excel file. but when i try to retrieve the
number of rows it gives me 65000, which is right. but only 6 rows are
used.

Is there anything i can do?
 
Hi Ryan,

thanks for your reply,

I was thinking to write to excel file. but when i try to retrieve the
number of rows it gives me 65000, which is right. but only 6 rows are
used.

Is there anything i can do?

Well, I don't quite follow you. Do you mean there are 65000 rows in
datagrid, but you only care 6 rows, and you only want to export and save
these 6 lines?

-Ryan
 
Ryan said:
Well, I don't quite follow you. Do you mean there are 65000 rows in
datagrid, but you only care 6 rows, and you only want to export and save
these 6 lines?

-Ryan

yes.

By default, the are 65000 lines in excel.
 
yes.

By default, the are 65000 lines in excel.

Sorry, I guess you are using some office driver or API, which I am not
familiar.

I always try to avoid use such drivers. I'd rahter use XHTML or csv, which
is more portable and you can have total control.

BTW, csc and xthml file can be open by excel. Or you can even just change
file ext to xls.

Ryan
 
Hi Alexia,

You could create a strong-typed DataSet to hold your data in memory. To
load data into the DataSet create an instance and call one of the
DataSet.ReadXml method overloads. To save the data simply call one of the
DataSet.WriteXml method overloads.

"Data Access in Client and Middle-Tier Programming
How to: Create a Typed Dataset"
http://msdn2.microsoft.com/en-us/library/04y282hb(vs.80).aspx

You can then bind the DataGridView directly to your DataSet.

"Data Access in Client and Middle-Tier Programming
Displaying Data Overview
§ BindingSource Component; § DataGridView Control"
http://msdn2.microsoft.com/en-us/library/2b4be09b(VS.80).aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top