Skip to main content

Posts

Showing posts from December, 2012

Entity Framework Versus LINQ To SQL (comparison summary)

LINQ to SQL and ADO.NET Entity Framework are extensions of ADO.NET and are introduced to avoid difficulties involved in writing programs using object oriented programming languages to access data residing in RDBMS. LINQ To SQL Entity Framework Complexity LINQ To SQL is easier to use. Entity Framework is more complex compared to LINQ To SQL. DB Server Support LINQ To SQL supports only Microsoft SQL Server. Entity Framework is built on top of ADO.NET data provider model and thus supports all existing ADO.NET data providers  i.e. IBM DB2, Sybase, Oracle, SQL Azure etc. File Type It uses Database Markup Language (DBML) file that contains XML mappings of entities to tables. Entity Framework uses four files EDMX, CSDL, SSDL and MSL. The later three are generated at runtime. Purpose Used for rapid application development. E

ASP.Net Web Forms: Export to Excel, Text, CSV, PDF, HTML and HTML

In this export series I have written sample to export data in Excel, Text/CSV, PDF and HTML files. You can check export sample here: Export to Excel – Export data in excel sheet. Export to Text/CSV – Export data in text/csv format. Export to PDF – Export application data in PDF file. Export to HTML – Export data in user defined HTML format. Export from Grid view to Excel. Export Page Screen Download or clone the  source code of export sample series. Note: Source code doesn't include export from Grid view sample. I hope you have enjoyed this series. Comment, feedback or any suggestion is always welcomed. Cheers!!!

ASP.Net: Export to PDF and open with save file dialog.

In last sample of my exporting sample series, I will demonstrate how to export data to PDF file in C#, ASP.Net. To export data in PDF file I’ll use iTextsharp library, which is included in source code project. For this example I’ll use same “ GetData ” method (to get the data for exporting) which we had used in Export to Excel example, you can use your own method to get data, if any. /// <summary> /// Export to Pdf file. /// </summary> public static void ExportPdfFile() {     //Create MemoryStream Object.     var stream = new MemoryStream ();     //New Document with Page Size and Margins.     var doc = new Document ( PageSize .LETTER, 50f, 50f, 40f, 40f);     // PdfWriter Object     var writer = PdfWriter .GetInstance(doc, stream);     writer.SetFullCompression();     //Open document.     doc.Open();     //Font Factory to set font type, size and style.     var style = FontFactory .GetFont(

ASP.Net: Export to HTML file and save with save file dialog in C#.

So continuing from my exporting sample series here I am narrating how to export data to HTML file in C#, ASP.Net. For this example I’ll use same “ GetData ” method (to get the data for exporting) which we had used in Export to Excel example, you can use your own method to get data. /// <summary> /// Export to Html /// </summary> public static void ExportHtmlFile() {     const string format = "<tr><td>{0}</td><td>{1}</td><td>{2}</td><td>{3}</td></tr>" ;     var sb = new StringBuilder ();     sb.AppendFormat( "<h1 style='font-size: 18px;font-weight: bold;'>{0}</h1>"         , "Export HTML Sample" );     sb.Append( "<table style='width:500px;'>" );     sb.AppendFormat(format         , "First Name"         , "Last Name"         , "Email Address"