Posts

Showing posts from April, 2013

html5 print page

HTML print


Just use the code in your page.

<input type="button" onClick="window.print()" value="Print" name="Print" />

how to import .csv file into sql server using c#

I am using the ASP.NET MVC. here is the code that might help you that how to you convert the CSV file in List and after that you will able to save the List data in to SQL.


[HttpPost] public ActionResult Create(t_NextDevAttendence t_nextdevattendence, IEnumerable<HttpPostedFileBase> files) { // Read the CSV file name & file path // I am usisg here Kendo UI Uploader string path = ""; string filenamee = ""; if (files != null) { foreach (var file in files) { var fileName = Path.GetFileName(file.FileName); path = Path.GetFullPath(file.FileName); filenamee = fileName; } // Read the CSV file data StreamReader sr = new StreamReader(path); string line = sr.ReadLine(); string[] value = line.Split(','); DataTable dt = new DataTable()…