H
Hexman
Hi All,
I have created a structure for a record (as I did in the old days with assembler, cobol, etc.). It contains several fields with various types. Using
it in arrays it functions nicely. Much the same as a datarow. I'm acquiring transactions from different sources, parsing them, validating them and
placing the data into the structure. Now, I want to write these transactions to a file.
How do I write the entire structure (one entry) to a streamwriter??? Is it possible to create a datatable with the same fields and structure and add
a row with one statement (moving the structure to the datarow)???
Just trying to organize a bit better and have flexibility (write to db or file).
Thanks,
Hexman
-----------------------------------------------------------------------------------------------------
Public Structure TransRecord
Dim TDate As Date
Dim TPONum As String
Dim TAmt As Double
End Structure
....
Dim TR as New TransRecord
TR.TDate = "06/12/06"
TR.TPONum = "12345-A"
TR.TAmt = 1450.25
Can I do something like the following?
streamWriter.Write(TR)
or
Dim dtTrans As New DataTable
Dim drTrans as New DataRow
dtTrans(0) = TR
----------------------------------------------------------------------------------------------------------
I have created a structure for a record (as I did in the old days with assembler, cobol, etc.). It contains several fields with various types. Using
it in arrays it functions nicely. Much the same as a datarow. I'm acquiring transactions from different sources, parsing them, validating them and
placing the data into the structure. Now, I want to write these transactions to a file.
How do I write the entire structure (one entry) to a streamwriter??? Is it possible to create a datatable with the same fields and structure and add
a row with one statement (moving the structure to the datarow)???
Just trying to organize a bit better and have flexibility (write to db or file).
Thanks,
Hexman
-----------------------------------------------------------------------------------------------------
Public Structure TransRecord
Dim TDate As Date
Dim TPONum As String
Dim TAmt As Double
End Structure
....
Dim TR as New TransRecord
TR.TDate = "06/12/06"
TR.TPONum = "12345-A"
TR.TAmt = 1450.25
Can I do something like the following?
streamWriter.Write(TR)
or
Dim dtTrans As New DataTable
Dim drTrans as New DataRow
dtTrans(0) = TR
----------------------------------------------------------------------------------------------------------