Unable to open text file

T

tshad

I am getting the following error when trying to open a text file:

Overload resolution failed because no accessible 'New' can be called without
a narrowing conversion

The code is:
*******************************************************
Dim objStreamWriter As StreamWriter

objStreamWriter = New StreamWriter(Server.MapPath("\uploads") & "\" &
"Report" & session("User").UserName & DateTime.now.toString("yyddMM"))
*******************************************************

This works in other programs.

What does the message mean?

Thanks,

Tom
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

It's probably because it can't determine the data type of the operand.

What does Session("User") contain? When you read the value it will have
the data type Object, and there is no UserName property in the Object
class. You have to specify the actual type of the data.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top