Flat Data Files - Best Practice?

  • Thread starter Thread starter Robert Reineri
  • Start date Start date
R

Robert Reineri

Hello All,

I have some flat files containing data that are uploaded to a web site about
every 15 minutes or so. I want to read the information out of them, and
display it in a simple datagrid control.

What I thought about doing was to write a small class that would read the
files, parse them, and write them back out as XML. Then I could use the XML
file as the data source for the grid. The files are pretty small, and it is
a low volume site, so I figured I could do this in Page_Load().

Any thoughts on this? Do you feel this is a reasonable approach? Am I doing
things the hard way? Is there a better approach?

Thanks so much for any ideas.

*** PLEASE REMOVE THE '123' from my email address should you decide to
respond by email.

Thanks

Robert
 
Hi Robert,

Yes why not, but you can also try this example
It needs a CSV text file and it is not a webdatagrid, but that is only one
databind extra at the end.

If you want the dataset also you can save it with
ds.writexml(path) and you have your xmlfile.

I hope this helps?

Cor

\\\
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim file As String = "Test2.txt"
Dim path As String = "C:\Test1\"
Dim ds As New DataSet
Try
Dim f As System.IO.File
If f.Exists(path & file) Then
Dim ConStr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
path & ";Extended Properties=""Text;HDR=No;FMT=Delimited\"""
Dim conn As New OleDb.OleDbConnection(ConStr)
Dim da As New OleDb.OleDbDataAdapter("Select * from " & _
file, conn)
da.Fill(ds, "TextFile")
End If
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
DataGrid1.DataSource = ds.Tables(0)
End Sub
///
 
Back
Top