Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
string newda = System.DateTime.Now.ToString("yyyy-MM-dd HH-mm");
string ttts = Session["username"] + newda;
Session["Filepath"] = "C:/techsoft/chart/" + ttts + ".xls";
File.AppendAllText("C:/techsoft/csv/" + ttts + ".csv", arrre[g] + "," + arrre1[g] + "\r\n");
Posted
Updated 23-Apr-13 2:09am
v2
Comments
Sandeep Mewara 22-Apr-13 7:52am    
Elaborate more on what are you trying to do.

Above code is not creating anything.
navin ks 22-Apr-13 7:56am    
Session["Filepath"] = "C:/techsoft/chart/" + ttts + ".xls"; this part of code must create a .xls file in chart folder. unfortunately its not created. i dont know why. code is too large to post here
[no name] 23-Apr-13 8:14am    
That is because, as you have already been told, that is just assigning a string to a session variable. You are not actually creating a file anywhere for .xls.

1 solution

Your code is just writing a bunch of text to a .CSv file. It doesn't appear to be doing anything with an XLS file.

So, the to your question of "Why?" is because you didn't write any code to do it.
 
Share this answer
 
Comments
navin ks 22-Apr-13 8:01am    
i need a xls file in chart folder. i need empty .xls file..
navin ks 22-Apr-13 8:01am    
y cant a empty xls file be created?
Dave Kreskowiak 22-Apr-13 8:11am    
BECAUSE YOU DIDN'T WRITE ANY CODE TO CREATE THE FILE!

Just specifying a filename as a string somewhere does not magically create a file at that path.
navin ks 22-Apr-13 8:13am    
File.AppendAllText("C:/techsoft/csv/" + ttts + ".csv", arrre[g] + "," + arrre1[g] + "\r\n"); this part of code creates .csv file. how?
Dave Kreskowiak 22-Apr-13 8:19am    
Are you elephanting kidding me?? Do you have ANY idea at all how File.AppendAllText works or even what it's used for?? If not, I suggest you try reading the documentation on it:

http://msdn.microsoft.com/en-us/library/ms143356.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900