By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,818 Members | 1,381 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,818 IT Pros & Developers. It's quick & easy.

Could not find file Error

P: n/a
Can anyone tell me why the below code returns error?
Exception Details: System.IO.FileNotFoundException: Could not find
file

Dim strLFolder As String = "c:\Temp\F Files"
Dim intClientID As Integer = 1221

Dim XMLStr As String = strLFolder & "\" &
intClientID.ToString.Trim & "\Lk\HeaderTrailerDeltails_data.xml"
Dim dsPubs As New DataSet
dsPubs.ReadXml(XMLStr)

where as the below code is working

Dim dsPubs As New DataSet
dsPubs.ReadXml("c:\temp\F Files\1221\Lk
\HeaderTrailerDeltails_data.xml")
Thanks

Jul 23 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Is Deltails in both intentional ?

My approach would be to read the directory content using DirectoryInfo and
do a char by char comparison to get the first mismatch char so that this is
my computer that works to find the difference (for example you could have a
non secable white space character that would be near impossible to find by
just looking).

--
Patrice

<Am***********@gmail.coma écrit dans le message de news:
11*********************@k79g2000hse.googlegroups.c om...
Can anyone tell me why the below code returns error?
Exception Details: System.IO.FileNotFoundException: Could not find
file

Dim strLFolder As String = "c:\Temp\F Files"
Dim intClientID As Integer = 1221

Dim XMLStr As String = strLFolder & "\" &
intClientID.ToString.Trim & "\Lk\HeaderTrailerDeltails_data.xml"
Dim dsPubs As New DataSet
dsPubs.ReadXml(XMLStr)

where as the below code is working

Dim dsPubs As New DataSet
dsPubs.ReadXml("c:\temp\F Files\1221\Lk
\HeaderTrailerDeltails_data.xml")
Thanks

Jul 23 '07 #2

P: n/a
On Jul 23, 1:41 pm, "Patrice" <http://www.chez.com/scribe/wrote:
Is Deltails in both intentional ?

My approach would be to read the directory content using DirectoryInfo and
do a char by char comparison to get the first mismatch char so that this is
my computer that works to find the difference (for example you could havea
non secable white space character that would be near impossible to find by
just looking).

--
Patrice

<Amritha.Da...@gmail.coma écrit dans le message de news:
1185211752.563657.16...@k79g2000hse.googlegroups.c om...
Can anyone tell me why the below code returns error?
Exception Details: System.IO.FileNotFoundException: Could not find
file
Dim strLFolder As String = "c:\Temp\F Files"
Dim intClientID As Integer = 1221
Dim XMLStr As String = strLFolder & "\" &
intClientID.ToString.Trim & "\Lk\HeaderTrailerDeltails_data.xml"
Dim dsPubs As New DataSet
dsPubs.ReadXml(XMLStr)
where as the below code is working
Dim dsPubs As New DataSet
dsPubs.ReadXml("c:\temp\F Files\1221\Lk
\HeaderTrailerDeltails_data.xml")
Thanks
The directory is valid and existing in the hard disk.
The problem is why it is throwing error if I use the first method?

I will have to use the first method because that enable me to get
different clientID values dynamically in the program.

Thanks

Jul 23 '07 #3

P: n/a
I don't see any obvious reason but my first assumption would be that this is
for some legitimate reason. So once again I would code a file name
comparision to make sure that there is no mismatch in particular regarding
white spaces that are almost uncheckable by just looking at them. Have you
tried what I have suggested ?

Also what if you try both code you submitted but using a single variable
that contains the file name (this way you are 100% sure that both file name
are the same) ?

Etc....
--
Patrice

<Am***********@gmail.coma écrit dans le message de news:
11**********************@d55g2000hsg.googlegroups. com...
On Jul 23, 1:41 pm, "Patrice" <http://www.chez.com/scribe/wrote:
Is Deltails in both intentional ?

My approach would be to read the directory content using DirectoryInfo and
do a char by char comparison to get the first mismatch char so that this
is
my computer that works to find the difference (for example you could have
a
non secable white space character that would be near impossible to find by
just looking).

--
Patrice

<Amritha.Da...@gmail.coma écrit dans le message de news:
1185211752.563657.16...@k79g2000hse.googlegroups.c om...
Can anyone tell me why the below code returns error?
Exception Details: System.IO.FileNotFoundException: Could not find
file
Dim strLFolder As String = "c:\Temp\F Files"
Dim intClientID As Integer = 1221
Dim XMLStr As String = strLFolder & "\" &
intClientID.ToString.Trim & "\Lk\HeaderTrailerDeltails_data.xml"
Dim dsPubs As New DataSet
dsPubs.ReadXml(XMLStr)
where as the below code is working
Dim dsPubs As New DataSet
dsPubs.ReadXml("c:\temp\F Files\1221\Lk
\HeaderTrailerDeltails_data.xml")
Thanks
The directory is valid and existing in the hard disk.
The problem is why it is throwing error if I use the first method?

I will have to use the first method because that enable me to get
different clientID values dynamically in the program.

Thanks
Jul 24 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Browse more ASP.NET Questions on Bytes