hi!
i'm new to the C#. net and need a help for my application, thanks in advance,problem is i have an application which has to read the data which is like this
-------------------------(white spaces which is in the file)
--------- abc ---------- d----------- efd----------- de
xxx----- 25.80---------12.10--------180000.0--------11111
yyyyyyyy---------------709.-----------.03-------------------
zz-------------------------------------1426.-------------------------
and has to make an entry in the database in a table as
table structure is name, abc , d, efd, de
first entry should be
name: xxx
abc:25.80
d:12.10
efd:180000.0
de:11111
second entry should be
name: yyyyyyyy
abc:
d:709.
efd:.03
de:
second entry should be
name: zz
abc:
d:
efd:.1426.
de:
|
Go4Expert Founder
|
![]() |
| 22Aug2007,21:16 | #2 |
|
Read a line using the InputFileStream and split the string based on the spaces and you have the row as you want to.
|
|
Newbie Member
|
|
| 22Aug2007,21:21 | #3 |
|
hi , thanks for replying , but in the rows there is not equal spaces in the columns...
|
|
Go4Expert Founder
|
![]() |
| 22Aug2007,21:45 | #4 |
|
Quote:
Originally Posted by dineshsachdeva |
|
Newbie Member
|
|
| 22Aug2007,21:52 | #5 |
|
we need a result like this
name: xxx abc:25.80 d:12.10 efd:180000.0 de:11111 second entry should be name: yyyyyyyy abc: d:709. efd:.03 de: second entry should be name: zz abc: d: efd:.1426. de: if we trim the blank spaces or check for null condition is there then how we can achieve the second enter and the third entry in the database |
|
Go4Expert Member
|
|
| 23Aug2007,00:31 | #6 |
|
tell whoever is giving you that garbage for input to come up with something more creative...
|
|
Go4Expert Member
|
|
| 23Aug2007,00:34 | #7 |
|
Read the whole document in one byte at a time, checking to see if it is whitespace or a character.
If you have a character, start adding what will be a word into an array, keep adding characters until the character to be added is a whitespace... Do this for the whole thing. Cross reference your arrays to match up the values. you know the first 4 array members will be, and what the 4 next array members will be, so you will have two arrays, one for the first line, one for the second, then repeat for each additional set of information. |

