saving Ascii file text as dataset and using it as combobox datasource

  • Thread starter Thread starter Nicholas Paldino [.NET/C# MVP]
  • Start date Start date
N

Nicholas Paldino [.NET/C# MVP]

Amos,

Your best bet would probably be to use one of the Text data providers
for OLE DB, and then read the contents in using the classes in the
System.Data.OleDb namespace. Once you do that, it will be in a data set
that you can bind to anything you wish.

You might want to switch to something like a comma-delimited or
tab-delimited file format though, just to be safe.

Hope this helps.
 
I have an ascii file with hundreds of lines that look like this:

00001 Test1 Myname
00002 Test2 Myname2
....

How can I move that to a dataset of three columns? If necessary, I can
modify the ascii file so that the dataset can read it more easily...
And once I have it as a dataset, how can I bind one of the columns to a
combobox control?

Thanks.
 
Where can I find more information on filling datasets using data providers?
Thanks.


Nicholas Paldino said:
Amos,

Your best bet would probably be to use one of the Text data providers
for OLE DB, and then read the contents in using the classes in the
System.Data.OleDb namespace. Once you do that, it will be in a data set
that you can bind to anything you wish.

You might want to switch to something like a comma-delimited or
tab-delimited file format though, just to be safe.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


Amos said:
I have an ascii file with hundreds of lines that look like this:

00001 Test1 Myname
00002 Test2 Myname2
...

How can I move that to a dataset of three columns? If necessary, I can
modify the ascii file so that the dataset can read it more easily...
And once I have it as a dataset, how can I bind one of the columns to a
combobox control?

Thanks.
 
Please refer to the .NET Framework SDK documentation. Look for
OleDbDataAdapter.
ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfsystemdataoledboledbdataadapterclasstopic.htm

Follow some of the links at the bottom and they'll give you some more
examples.

-c
Where can I find more information on filling datasets using data providers?
Thanks.


Amos,

Your best bet would probably be to use one of the Text data providers
for OLE DB, and then read the contents in using the classes in the
System.Data.OleDb namespace. Once you do that, it will be in a data set
that you can bind to anything you wish.

You might want to switch to something like a comma-delimited or
tab-delimited file format though, just to be safe.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


I have an ascii file with hundreds of lines that look like this:

00001 Test1 Myname
00002 Test2 Myname2
...

How can I move that to a dataset of three columns? If necessary, I can
modify the ascii file so that the dataset can read it more easily...
And once I have it as a dataset, how can I bind one of the columns to a
combobox control?

Thanks.
 
Back
Top