Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > String concatination

Reply
Thread Tools

String concatination

 
 
Rajika Somasiri
Guest
Posts: n/a
 
      02-09-2004
In the following code "fname" is a variable for a file name and "name" is a
string variable. But when I use fname it does not contain the ".txt" part.
Therefore I cannot create the file.

private StreamWriter StartTracking(string name)

{

try

{

if(!Directory.Exists("Info"))

Directory.CreateDirectory("Info");

string fname = "Info\\" + DateTime.Now.ToString("ddMMyyHHmm")+ name+ ".txt";


infowriter = new StreamWriter(new FileStream(fname,
FileMode.OpenOrCreate,FileAccess.Write));

return infowriter;

}

catch(Exception ev)

{

string msg = ev.Message;

return null;

}

}






 
Reply With Quote
 
 
 
 
Anusha Nanayakkara
Guest
Posts: n/a
 
      02-23-2004
Hi,

"name" may be use as a keyword. You better try with strName insted of "name" variable.

Anusha

>In the following code "fname" is a variable for a file name and "name" is a
> string variable. But when I use fname it does not contain the ".txt" part.
> Therefore I cannot create the file.
>
> private StreamWriter StartTracking(string name)
>
> {
>
> try
>
> {
>
> if(!Directory.Exists("Info"))
>
> Directory.CreateDirectory("Info");
>
> string fname = "Info\\" + DateTime.Now.ToString("ddMMyyHHmm")+ name+ ".txt";
>
>
> infowriter = new StreamWriter(new FileStream(fname,
> FileMode.OpenOrCreate,FileAccess.Write));
>
> return infowriter;
>
> }
>
> catch(Exception ev)
>
> {
>
> string msg = ev.Message;
>
> return null;
>
> }
>
> }
>
>
>
>
>
>
>


___
Newsgroups brought to you courtesy of www.dotnetjohn.com
 
Reply With Quote
 
 
 
 
Anusha Nanayakkara
Guest
Posts: n/a
 
      02-23-2004
Hi
Use "strName" insted of "name" variable and try weather it's working

Anusha.

>In the following code "fname" is a variable for a file name and "name" is a
> string variable. But when I use fname it does not contain the ".txt" part.
> Therefore I cannot create the file.
>
> private StreamWriter StartTracking(string name)
>
> {
>
> try
>
> {
>
> if(!Directory.Exists("Info"))
>
> Directory.CreateDirectory("Info");
>
> string fname = "Info\\" + DateTime.Now.ToString("ddMMyyHHmm")+ name+ ".txt";
>
>
> infowriter = new StreamWriter(new FileStream(fname,
> FileMode.OpenOrCreate,FileAccess.Write));
>
> return infowriter;
>
> }
>
> catch(Exception ev)
>
> {
>
> string msg = ev.Message;
>
> return null;
>
> }
>
> }
>
>
>
>
>
>
>


___
Newsgroups brought to you courtesy of www.dotnetjohn.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Concatination creates invalid preprocessor parameter? Noah Roberts C++ 5 01-12-2011 11:03 AM
The ole Repetion != Concatination pitfall JChG Python 1 04-19-2010 04:48 AM
Preprocessor concatination of defines Jakob Simon-Gaarde C++ 4 07-02-2004 03:17 AM
String concatination Rajika Somasiri ASP .Net Web Controls 1 02-09-2004 05:41 AM
Writing a listbox value to an html link concatination Crystal ASP General 3 07-09-2003 05:50 PM



Advertisments