J
JenHu
Hi all,
I have to read from a text file and generate values and insert to
database.
But first of all, when the text file contains '0000000000', I received
a sEfundAmt value = 0D instead of 0.0 on
sEfundAmt = Decimal.Parse(Mid$(sRetLine, 30, 10)) / 100.0
For example, in the text file, value is '0000150776', I want to
convert it to 1507.76,
if value is '0000000000', the sEfundAmt should be 0.0
I tried Int32.Parse (Mid$(sRetLine, 30, 10)) / 100.0 , and the result
is 0.0, but whenever it is tried to convert to decimal, the result is
not correct. How to get around it?
Thank you.
Here is the partial code:
-----------------------------------------------------------
Dim sr As New StreamReader(savePath & filename)
Dim sRetLine As String
Dim sEfundAmt As Decimal
Try
While sr.Peek > -1
sRetLine = sr.ReadLine
sEfundAmt = Decimal.Parse(Mid$(sRetLine, 30, 10)) /
100.0
Catch err As Exception
message.Text = err.Message
End Try
*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
I have to read from a text file and generate values and insert to
database.
But first of all, when the text file contains '0000000000', I received
a sEfundAmt value = 0D instead of 0.0 on
sEfundAmt = Decimal.Parse(Mid$(sRetLine, 30, 10)) / 100.0
For example, in the text file, value is '0000150776', I want to
convert it to 1507.76,
if value is '0000000000', the sEfundAmt should be 0.0
I tried Int32.Parse (Mid$(sRetLine, 30, 10)) / 100.0 , and the result
is 0.0, but whenever it is tried to convert to decimal, the result is
not correct. How to get around it?
Thank you.
Here is the partial code:
-----------------------------------------------------------
Dim sr As New StreamReader(savePath & filename)
Dim sRetLine As String
Dim sEfundAmt As Decimal
Try
While sr.Peek > -1
sRetLine = sr.ReadLine
sEfundAmt = Decimal.Parse(Mid$(sRetLine, 30, 10)) /
100.0
Catch err As Exception
message.Text = err.Message
End Try
*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*