C#/XML file naming problem
-
Ok, so I have this app that you fill in your subject and then the message and then it formats it in the particular way i told it to, onto my webserver as a .xml file....
XmlTextWriter writer = new XmlTextWriter("poofacedjohn.xml", null);
But, what I need is for the name of the xml file not to be poofacedjohn.xml, but rather the year, month, day, hour, and minute of the local machine... like..... 20030426_1718.xml 2003 04 26 17 18 |year||month||day|_|hour||minute| how would I acheive this...? I can do it in asp.net, but it's not working for me as just a regular windows app. /\ |_ E X E GG -
Ok, so I have this app that you fill in your subject and then the message and then it formats it in the particular way i told it to, onto my webserver as a .xml file....
XmlTextWriter writer = new XmlTextWriter("poofacedjohn.xml", null);
But, what I need is for the name of the xml file not to be poofacedjohn.xml, but rather the year, month, day, hour, and minute of the local machine... like..... 20030426_1718.xml 2003 04 26 17 18 |year||month||day|_|hour||minute| how would I acheive this...? I can do it in asp.net, but it's not working for me as just a regular windows app. /\ |_ E X E GGHow are you trying do it, and what errors are you getting?
-
Ok, so I have this app that you fill in your subject and then the message and then it formats it in the particular way i told it to, onto my webserver as a .xml file....
XmlTextWriter writer = new XmlTextWriter("poofacedjohn.xml", null);
But, what I need is for the name of the xml file not to be poofacedjohn.xml, but rather the year, month, day, hour, and minute of the local machine... like..... 20030426_1718.xml 2003 04 26 17 18 |year||month||day|_|hour||minute| how would I acheive this...? I can do it in asp.net, but it's not working for me as just a regular windows app. /\ |_ E X E GGTry:
string name = DateTime.Now.ToString("yyyyMMdd_hhmm") + ".xml";
XmlTextWriter writer = new XmlTextWriter(name, null);
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Try:
string name = DateTime.Now.ToString("yyyyMMdd_hhmm") + ".xml";
XmlTextWriter writer = new XmlTextWriter(name, null);
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
How are you trying do it, and what errors are you getting?
-
Try:
string name = DateTime.Now.ToString("yyyyMMdd_hhmm") + ".xml";
XmlTextWriter writer = new XmlTextWriter(name, null);
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Try:
string name = DateTime.Now.ToString("yyyyMMdd_hhmm") + ".xml";
XmlTextWriter writer = new XmlTextWriter(name, null);
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Wait, one more thing... I have this programed saved in ...
C:\Inetpub\wwwroot\WebLog\Entries\bin
and it's working fine, but I need the .xml to be saved in....C:\Inetpub\wwwroot\WebLog\Entries
How can I change the following to save the .xml file in the \Entries folder?string fileName = DateTime.Now.ToString("yyyyMMdd_hhmm") + ".xml"; XmlTextWriter writer = new XmlTextWriter(fileName, null);
/\ |_ E X E GG -
Wait, one more thing... I have this programed saved in ...
C:\Inetpub\wwwroot\WebLog\Entries\bin
and it's working fine, but I need the .xml to be saved in....C:\Inetpub\wwwroot\WebLog\Entries
How can I change the following to save the .xml file in the \Entries folder?string fileName = DateTime.Now.ToString("yyyyMMdd_hhmm") + ".xml"; XmlTextWriter writer = new XmlTextWriter(fileName, null);
/\ |_ E X E GG