Memory Table in .NET ?

  • Thread starter Thread starter ItsMe
  • Start date Start date
I

ItsMe

Hi,

I've 4 fields are as follows:

Field Name DataType
---------- --------
SLNo AutoIncrement
ItemCode String(10)
Qty Integer
Price Currency

I've three textboxes in a form, and I'll be validating accordingly and once
validation suceeds, I want to store in a memory table. I don't want to use
Arrays. I should be able to add/edit/delete and display all the records in a
grid. And I should be able to wipe out the information once my work is done.

Can I use DataTables / XML, if yes how? Any ideas will be highly
appreciated.

Regards
ItsMe
 
Hi ItsMe...
I've three textboxes in a form, and I'll be validating accordingly and once
validation suceeds, I want to store in a memory table. I don't want to use
Arrays.

You confuse me, what is a memory table?
I always was thinking that an array was a memory table, but it seems not to
be.
Cor
 
I meant Memory table means Temporary table which resides on the memory like
array. I think table will be more userfriend than an array. What do you
think that i should use Array or DataTable ? Any idea ?
 
Hi,
I think maybe you can use a XML file as a dataset.
I did that once and is not a hell of a job although I have no example.
I thought that that is easily to bind to almost everything.
As far as I remember me, did Fergus give some examples of that in this
newsgroup, maybe you can do a Google search.
Cor
 
ItsMe,
As Cor stated you want to use a DataSet. A DataSet contains one or more
DataTables. A DataTable is very similar to a database table only it resides
in memory.

A DataSet is able to be stored as an XML file, however while in memory it is
not XML. Its actually a collection of collections of objects. Using
DataAdapters a DataTable can be persisted to a database. However it never
needs to be persisted (it can be created, used, and discarded).

If the table is for a single form, I would suggest you simply select the
Data tab of the tool box and drag a DataSet onto your form. Select 'Untyped
dataset' then click Ok. Within the properties Window for the DataSet that
was created (it will be in the component tray of your form). you can select
Tables, and use the Table Collection Editor to define your table &
columns...

If the table is used for multiple forms, then you may want to add a DataSet
to your project and define it there.

Of course you can define the DataTable & DataColumn objects completely in
code also.

David Sceppa's book "Microsoft ADO.NET - Core Reference" from MS Press
provides a wealth of information on Datasets and DataTables and how to
interact with them from code.

DataSet & DataTable (along with the other supporting classes) are found in
the System.Data namespace and the System.Data assembly.

Hope this helps
Jay
 
Hi,

Use a structure; then build a datatable from it to display it in the grid.
(You might be able to display the structure directly in the grid, but I'm
not certain about this.) The data is by definition destroyed when the work
is done, unless you choose to save it to a permanent table.

HTH,

Bernie Yaeger
 
Dear Cor,

I've done using DataTable, and it works perfectly fine and you can destroy
it after your work finsih, so it won't remain in the memory.

And I'll definitely look into xml datasets as well.

Thanks
Regards
 
Back
Top