Tuesday, February 28, 2017

C# create folder on runtime

You can try this code: this will read data from app.config for folder path. if the the path is not found then it it will create folder.

 string curDirectory = ConfigurationManager.AppSettings["AppOutPath"];  
 if (Directory.Exists(curDirectory + @"\Uploads"))  
           // Do something  
           Directory.CreateDirectory(curDirectory + @"\Uploads");  
           // Do something  

Monday, February 27, 2017

sql replace coma seperated string

I have a string like this:


From this string i want to  remove 00001 with '' because this is a prefix of my every coma separated value.

 REPLACE((SUBSTRING(m_rx_nos,6,LEN(CAST(m_rx_nos AS VARCHAR(500)))-6)),(',0000'+ CONVERT(VARCHAR(100),f.pharminfoid_FK)),',') as m_rx_nos  

 Out Put:


C# print file on LAN Printer

If you want to print any file on network printer then you can try with this code block // Change Default Printer System.Ma...