Category - C#.Net
19 Feb 2008
4 Comments   92132 Views
Here Mudassar Ahmed Khan has explained how to use parameterized queries to query SQL Server database in order to avoid SQL Injection attacks
31 Jan 2009
1 Comments   64263 Views
Here Mudassar Ahmed Khan has explained how to export data to Microsoft Excel workbook using ADO.Net and C#
01 Feb 2009
1 Comments   34485 Views
Here Mudassar Ahmed Khan has explained how to make AJAX Calls using JavaScript and XMLHttp to fetch data from server in ASP.Net
03 Feb 2009
1 Comments   38206 Views
Here Mudassar Ahmed Khan has explained how to use AJAX JavaScript and XMLHttp to query the server and find out whether user name already exists in the database using C and Vb.Net
04 Feb 2009
11 Comments   105206 Views
Here Mudassar Ahmed Khan has explained how to read and import data to Microsoft Excel workbook using ADO.Net and C#
12 Feb 2009
12 Comments   57505 Views
Here Mudassar Ahmed Khan has explained how to send emails using C# and asp.net. He has also explained how to send emails on a new thread to improve performance.
15 Feb 2009
9 Comments   42321 Views
Here Mudassar Ahmed Khan has explained how to attach files to email without saving them onto the disk directly from the FileUpload stream
19 Feb 2009
79 Comments   227891 Views
Here Mudassar Ahmed Khan has explained how to save file as binary data inside SQL Server database and also how to retreive them and reconvert to their respective formats using VB.net amd C#.
21 Feb 2009
49 Comments   321424 Views
Here Mudassar Ahmed Khan has explained how to retrieve and display images that are stored in SQL Server Database in ASP.Net Web application
21 Feb 2009
9 Comments   66664 Views
Here Mudassar Khan has explained How to display images that are stored outside the Website Root Folder
22 Mar 2009
18 Comments   64354 Views
Here Mudassar Ahmed Khan has explained how to pull RSS from a website and display the same on the web page using ASP.Net
06 Apr 2009
10 Comments   116242 Views
Here Mudassar Ahmed Khan has explained how to find the control that caused the postback in ASP.Net
12 Apr 2010
21 Comments   54312 Views
Here Mudassar Ahmed Khan has explained how to call parent page method from child user control placed on the same page whose function or method we want to call.
25 Apr 2010
2 Comments   19778 Views
Here Mudassar Ahmed Khan has explained how to Populate and Bind Custom Business Objects or properties collection to databound controls like ASP.Net GridView Control
13 Jun 2010
5 Comments   20849 Views
Here Mudassar Ahmed Khan has explained how to bind an XML or XML File to ASP.Net DropDownList Control using DataSet in C# and VB.Net
01 Jul 2010
0 Comments   43445 Views
Here Mudassar Ahmed Khan has explained how to preserve values or states of custom properties across postbacks in ASP.Net
24 Jul 2010
3 Comments   27619 Views
Here Mudassar Ahmed Khan has explained how to make use of the new feature Parallelism in .Net 4.0 making use of the new classes Parallel and PLINQ (Parallel LINQ)
18 Dec 2010
4 Comments   180204 Views
Here Mudassar Ahmed Khan has explained how to list the installed instances of SQL Server on machine and LAN Network using C# and VB.Net
27 Dec 2010
18 Comments   75719 Views
In this article Mudassar Ahmed Khan has explained how to read emails from POP3 server using OpenPop.Net Library using C# and VB.Net
03 Jan 2011
10 Comments   45086 Views
In this article Mudassar Ahmed Khan has explained how to read emails from POP3 server using OpenPop.Net Library using C# and VB.Net
04 Jan 2011
1 Comments   10453 Views
Here Mudassar Ahmed Khan has explained the difference between string and String keywords in C# and also the difference between bool and Boolean class.
13 Apr 2011
18 Comments   105085 Views
Here Mudassar Ahmed Khan has explained how to create and send HTML Formatted Emails in ASP.Net using C# and VB.Net
25 Apr 2011
11 Comments   122086 Views
Here Mudassar Ahmed Khan has explained how to implement the free ASP.Net Mathematical Captcha Control in C# and VB.Net
07 Aug 2011
4 Comments   118620 Views
Here Mudassar Ahmed Khan has explained the exception DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'ID' in ASP.Net
17 Aug 2011
10 Comments   61134 Views
Here Mudassar Ahmed Khan has explained how to modify the ASP.Net WCF (Windows Communication Foundation) service to make it accept AJAX JSON calls and to make AJAX JSON calls to ASP.Net WCF Service using JavaScript and jQuery
02 Nov 2011
0 Comments   23604 Views
Here Mudassar Ahmed Khan has explained how to get distinct list of custom business class objects using LINQ Query in .Net
08 Feb 2012
5 Comments   48123 Views
Here Mudassar Ahmed Khan has explained how to convert Text string to Image using C# and VB.Net in ASP.Net Web application and display the converted image in Image Control
21 Feb 2012
3 Comments   36009 Views
Here Mudassar Ahmed Khan has explained how to programmatically add and update SQL connection strings in ASP.Net Web.Config file using C# and VB.Net.
He has explained how we can access and update the different attributes of a connection string like DataSource, IntitialCatalog, UserId, Password and IntegratedSecurity.
01 Aug 2012
8 Comments   64477 Views
Here Mudassar Ahmed Khan has explained how to fetch and read email messages with attachments from GMAIL POP3 mail server inbox in ASP.Net. The fetched emails are bound to ASP.Net GridView and users are able to download the attachments.
20 Aug 2012
6 Comments   54120 Views
Here Mudassar Ahmed Khan has explained how to send Rich Text HTML Emails with embedded images and pictures using VB.Net and C# in ASP.Net
03 Sep 2012
2 Comments   13714 Views
Here Mudassar Ahmed Khan has explained how to create dynamic button controls at runtime and also attach OnClick event handlers to the dynamically generated buttons in Windows Forms (WinForms) Application using VB.Net and C#.
12 Oct 2012
2 Comments   55447 Views
Here Mudassar Ahmed Khan has explained with an example and attached sample code how to minimize Windows Application to System Tray using VB.Net and C#.
29 Oct 2012
0 Comments   45596 Views
Here Mudassar Ahmed Khan has explained with an example and attached sample code, how to Populate bind GridView with Generic List in ASP.Net using C# and VB.Net.
Generic Lists are created from Custom Business Objects also known as Property Class
30 Oct 2012
0 Comments   23883 Views
Here Mudassar Ahmed Khan has explained with an example and attached sample code, how to bind Generic List to GridView in ASP.Net using C# and VB.Net.
Generic Lists are created from Custom Business Objects also known as Property Class
03 Apr 2013
0 Comments   13425 Views
Here Mudassar Ahmed Khan has explained with an example, how to delete folder or directory using C# and VB.Net
A Directory that contains files or folders cannot be deleted hence this code first deletes all the Child Directories and also all the files in the Directory as well the Child Directories.
10 Apr 2013
0 Comments   21169 Views
Here Mudassar Ahmed Khan has explained with an example, how to recursively all delete all directories (sub directories or folders or sub folders) in C# an VB.Net
16 Apr 2013
0 Comments   8740 Views
Here Mudassar Ahmed Khan has explained with an example and attached sample code,
how to send emails using GMAIL Account Credentials in ASP.Net using C#.
27 Jul 2013
0 Comments   44829 Views
Here Mudassar Ahmed Khan has explained, how to populate DropDownList from XML file in ASP.Net
07 Aug 2013
6 Comments   46848 Views
Here Mudassar Ahmed Khan has explained, how to send email with attachment in ASP.Net.

The file to be send as attachment along with mail will be uploaded using FileUpload control and will be dynamically added as attachment in the MailMessage class object without saving in any folder on disk.

For this example, for sending emails Gmail SMTP Mail Server will be used. To send email with Gmail SMTP Server, you will need to use an email address and password of a valid Gmail account and along with that you will need the Gmail SMTP Mail Server settings.
09 Aug 2013
1 Comments   35615 Views
Here Mudassar Ahmed Khan has explained, how to remove (delete) duplicate rows (records) from DataTable using DataView in C# and VB.Net.

The idea is to convert the DataTable to DataView and then from DataView back to DataTable using the DataView ToTable method which has option to return distinct (unique) rows (records) of DataTable, thus ultimately it removes (deletes) duplicate rows (records).
17 Aug 2013
4 Comments   47636 Views
Here Mudassar Ahmed Khan has explained, how to add dynamic controls like Label, TextBox, Button, etc. to Windows Forms ( WinForms ) Application on click of a Button.

He has also explain how we can attach event handler to various dynamically added controls like TextBox, Button, etc.
17 Aug 2013
0 Comments   8779 Views
Here Mudassar Ahmed Khan has explained with an example, how to recursively all delete files in all directories (sub directories or folders or sub folders) in C# and VB.Net
18 Aug 2013
2 Comments   91184 Views
Here Mudassar Ahmed Khan has explained, how to dynamically (programmatically) at runtime create a DataTable using C# or VB.Net and then bind it to GridView in ASP.Net.

First a dynamic DataTable object is created and its schema (Table structure and Columns) is defined programmatically. Once the columns are defined, then rows (records) are added to the dynamically generated DataTable.

Once the dynamic DataTable is populated with records, it is bound to an ASP.Net GridView control.
21 Aug 2013
1 Comments   34046 Views
Here Mudassar Ahmed Khan has explained, how to dynamically create DataTable and bind to GridView in ASP.Net using C# and VB.Net
22 Aug 2013
20 Comments   74825 Views
Here Mudassar Ahmed Khan has explained, the difference between ArrayList and Generic List (List) in C# .Net and VB.Net.
05 Sep 2013
6 Comments   23174 Views
Here Mudassar Ahmed Khan has explained, how to send email with attachment in ASP.Net.

The file to be send as attachment along with mail will be uploaded using FileUpload control and will be dynamically added as attachment in the MailMessage class object without saving in any folder on disk.

For this example, for sending emails Gmail SMTP Mail Server will be used. To send email with Gmail SMTP Server, you will need to use an email address and password of a valid Gmail account and along with that you will need the Gmail SMTP Mail Server settings.
16 Sep 2013
12 Comments   108326 Views
Here Mudassar Ahmed Khan has explained how to use and return value from Stored Procedure using Output Parameter in ASP.Net.

For this article I a Table named Fruits is used which contains FruitId and FruitName columns. The name of the Fruit is fetched using Output Parameter in SQL Server Stored Procedure in ASP.Net
13 Nov 2013
3 Comments   33592 Views
Here Mudassar Ahmed Khan has explained how to programmatically add, modify (change) and update SQL connection strings at runtime in ASP.Net Web.Config file using C# and VB.Net.

He has explained how we can access and update the different attributes of a connection string like DataSource, IntitialCatalog, UserId, Password and IntegratedSecurity.
16 Nov 2013
3 Comments   35541 Views
Here Mudassar Ahmed Khan has explained how to encrypt and decrypt file such as Word (DOC, DOCX), Excel (XLS, XLSX), PDF, Text (TXT) documents or JPG, PNG or GIF Images using C# and VB.Net in ASP.Net website.

The file will be uploaded for Encryption and Decryption of Files. For Encryption and Decryption of files, the AES Symmetric key (Same key) algorithm is used. The encrypted and decrypted files can be saved inside folders on disk or can be downloaded to client user.
02 Jan 2014
0 Comments   36003 Views
Here Mudassar Ahmed Khan has explained how to modify the ASP.Net WCF (Windows Communication Foundation) service to make it accept AJAX JSON calls and to make AJAX JSON calls to ASP.Net WCF Service using JavaScript and jQuery
18 Jan 2014
3 Comments   43505 Views
Here Mudassar Ahmed Khan has explained how to read Excel File using OLEDB Data Provider Connection in C# .Net. Excel Workbook is just like database with sheets corresponding to tables.
This article covers reading of both Excel 2003 as well as OpenXML i.e. Excel 2007, 2010 and 2013 formats.
17 Feb 2014
1 Comments   18856 Views
Here Mudassar Ahmed Khan has explained how to preserve or persists data / class objects / variable values across PostBacks in ASP.Net.

This is done by saving the data / class objects / variable in a ViewState object and then fetching it from it whenever needed.
03 May 2014
2 Comments   15465 Views
Here Mudassar Ahmed Khan has explained how to encrypt and decrypt XML File using C# and VB.Net.

The XML file will be uploaded for Encryption and Decryption of Files. For Encryption and Decryption of files, the AES Symmetric key (Same key) algorithm is used. The encrypted and decrypted files can be saved inside folders on disk or can be downloaded to client user.
12 Jun 2014
7 Comments   19372 Views
Here Mudassar Ahmed Khan has explained how to send or pass DataTable as parameter to Stored Procedure in C# and VB.Net using the SQL Server User Defined Table Type.

The User Defined Table Type has to be created in SQL Server and it must have the same schema as that of the DataTable that we need to pass to the Stored Procedure as parameter.
26 Jun 2014
0 Comments   14967 Views
Here Mudassar Ahmed Khan has explained how to display ‘st’, ‘nd’, ‘rd’ and ‘th’ suffix after day numbers in Formatted Date string using C# and VB.Net.

By default .Net does not have any provision to display the display ‘st’, ‘nd’, ‘rd’ and ‘th’ suffix after day numbers in Formatted Date string and hence I have come up with a generic method for accomplishing the task.
28 Jun 2014
2 Comments   14989 Views
Here Mudassar Ahmed Khan has explained how to dynamically generate PDF in Memory from HTML using iTextSharp and send the generated PDF as Email Attachment using C# and VB.Net.

Using iTextSharp Library, the PDF is generated from HTML string in memory by making use of MemoryStream class and then the same is attached to the MailMessage object and send as email attachment.
03 Jul 2014
3 Comments   24568 Views
Here Mudassar Ahmed Khan has explained how to read and write BLOBs (Binary Large Objects) data to SQL Server database using C# and VB.Net.

BLOBs include files such as Images, PDF, Word or Excel Documents, Audio, Video files. Such files are read converted to an array of bytes and inserted into SQL Server VARBINARY or IMAGE fields.
03 Jul 2014
0 Comments   15779 Views
Here Mudassar Ahmed Khan has explained how to dynamically create PDF from HTML string using iTextSharp and send the generated PDF as Email Attachment in ASP.Net using C# and VB.Net.
04 Jul 2014
1 Comments   19849 Views
Here Mudassar Ahmed Khan has explained with a simple example how to use Parallel ForEach Loop in C# and VB.Net using .Net 4.0 and .Net 4.5.

Parallelism can be achieved in two ways
1. Parallel class
2. PLINQ (Parallel LINQ)

Here he has explained how to achieve parallelism using Parallel ForEach Loop.
04 Jul 2014
0 Comments   6608 Views
Here Mudassar Ahmed Khan has explained what is Parallel LINQ (PLINQ) and a simple example how to write a PLINQ Query in C# and VB.Net .Net 4.0 and .Net 4.5.

Parallelism can be achieved in two ways
1. Parallel class
2. PLINQ (Parallel LINQ)

Here he has explained how to achieve parallelism using Parallel LINQ (PLINQ).
16 Jul 2014
1 Comments   7466 Views
Here Mudassar Ahmed Khan has explained with an example, how to pass Table Valued Parameters to SQL Server Stored Procedure from .Net Code Behind using ADO.Net, C# and VB.Net.
05 Aug 2014
1 Comments   13161 Views
Here Mudassar Ahmed Khan has explained how to pass multiple records (rows) to a Stored Procedure in SQL Server using C# and VB.Net.
We can pass a Table containing multiple records (rows) to a Stored Procedure by making use of Table Valued parameters in SQL Server.
11 Aug 2014
0 Comments   6164 Views
Here Mudassar Ahmed Khan has explained how to save file as binary data inside SQL Server database and also how to retrieve them and convert them back to their respective formats using C# and VB.Net.
11 Aug 2014
0 Comments   10403 Views
Here Mudassar Ahmed Khan has explained how to save image as binary data into SQL Server database and also how to retrieve and convert the image back to their respective formats using C# and VB.Net.
24 Aug 2014
1 Comments   7271 Views
Here Mudassar Ahmed Khan has explained how to create text image on the fly with ASP.Net using C# and VB.Net.

The image generation is done dynamically using GDI+ library in ASP.Net.
24 Sep 2014
0 Comments   10351 Views
Here Mudassar Ahmed Khan has explained how to export data (records) from SQL Server Table to Text (Notepad) file in ASP.Net using C# and VB.Net. This article will work for all SQL Server versions i.e. 2005, 2008, 2008R2, 2012, etc.

The data will be first fetched into a DataTable and then the DataTable will be exported to a Text file which can be viewed in Notepad.
14 Oct 2014
0 Comments   22806 Views
Here Mudassar Ahmed Khan has explained how to export DataGridView data to Excel file in Windows Forms (WinForms) Applications using OpenXml and ClosedXml Excel conversion libraries, C# and VB.Net.

DataGridView cannot be exported directly to Excel file and hence need to generate a DataTable and export the DataTable to Excel file.
09 Dec 2014
0 Comments   4013 Views
Here Mudassar Ahmed Khan has explained how to Rotate / Flip / Transpose DataTable - Convert DataTable Columns to Rows and Rows to Columns using C# and VB.Net.
He has also explained how we can get back the original DataTable from the Rotated / Flipped / Transposed DataTable using C# and VB.Net.
13 Dec 2014
3 Comments   6417 Views
Here Mudassar Ahmed Khan has explained how to insert (save) Hindi, Marathi, Gujarati, Urdu, Persian, Arabic, Tamil and Telugu languages Text characters in SQL Server database using ASP.Net, C# and VB.Net.

In SQL Server database we will need to use NVARCHAR data type to store the various languages text characters.
17 Dec 2014
0 Comments   5561 Views
Here Mudassar Ahmed Khan has explained how to dynamically generate and display barcode image in Windows Forms (WinForms) Application using C# and VB.Net.
23 Jan 2015
0 Comments   1989 Views
Here Mudassar Ahmed Khan has explained how to Rotate / Flip / Transpose DataTable - Convert DataTable Columns to Rows and Rows to Columns using C# and VB.Net.
He has also explained how we can get back the original DataTable from the Rotated / Flipped / Transposed DataTable using C# and VB.Net.
18 Mar 2015
0 Comments   3173 Views
Here Mudassar Ahmed Khan has explained how to add page numbers to existing PDF file using iTextSharp in C# and VB.Net.
The pages of the PDF file will be read and then using the PdfStamper class page numbers will be written to each page of the PDF document.
24 Mar 2015
0 Comments   1372 Views
Here Mudassar Ahmed Khan has explained a tutorial with example on how to use the JavaScript XmlHttpRequest to make Asynchronous calls to the server and fetch data.
21 Apr 2015
1 Comments   6819 Views
Here Mudassar Ahmed Khan has explained with examples, how to calculate Sum (Total) of DataTable Columns using C# and VB.Net.

This article explains how to calculate Sum (Total) of DataTable Columns using the following two methods.
1. DataTable Compute function.
2. Using LINQ.
23 Apr 2015
0 Comments   1963 Views
Here Mudassar Ahmed Khan has explained how to create and drop (delete) SQL Server Table programmatically using ADO.Net, C# and VB.Net.

The Create and Drop script will be dynamically generated and the Table will be respectively created or deleted in SQL Server database.
25 Apr 2015
0 Comments   1627 Views
C#.Net   VB.Net   XML
Here Mudassar Ahmed Khan has explained with examples, how to use XPath with XmlDocument and how to select XML nodes by Name and Attribute value using XPath expression in C# and VB.Net.
03 May 2015
0 Comments   1277 Views
Here Mudassar Ahmed Khan has explained a short article to clear a common doubt faced by developers i.e. what is the difference between small string and capital String data types in C# .Net.
03 May 2015
0 Comments   866 Views
Here Mudassar Ahmed Khan has explained a short article to clear a common doubt faced by developers i.e. what is the difference between bool and Boolean data type in C# .Net.
05 May 2015
0 Comments   869 Views
Here Mudassar Ahmed Khan has explained with example, how to read binary data files and convert them to their respective file formats and write the files as binary data and save it to database.
05 May 2015
0 Comments   1679 Views
Here Mudassar Ahmed Khan has explained how to convert / copy DataReader (SqlDataReader) data to DataTable and DataSet using C# and VB.Net.
The DataTable and DataSet will be populated with records from the DataReader using Load method of the DataTable.
09 May 2015
0 Comments   1193 Views
Here Mudassar Ahmed Khan has explained how to call (consume) Web Service (ASMX) in Windows Forms (WinForms) application using C# and VB.Net.
09 May 2015
0 Comments   1050 Views
Here Mudassar Ahmed Khan has explained how to call (consume) Web Service (ASMX) in Console application using C# and VB.Net.
11 May 2015
0 Comments   1401 Views
Here Mudassar Ahmed Khan has explained how to send HTML Page (File) as Email Body in ASP.Net using C# and VB.Net.
12 May 2015
0 Comments   1544 Views
Here Mudassar Ahmed Khan has explained how to attach a File from MemoryStream to MailMessage object and send as email attachment in ASP.Net using C# and VB.Net.
This article will explain how to attach a PDF file from MemoryStream to MailMessage object and send as email attachment in ASP.Net using C# and VB.Net.
03 Jul 2015
0 Comments   456 Views
Here Mudassar Ahmed Khan has explained with an example, how to convert Byte Array to Base64 String using C# and VB.Net.
10 Jul 2015
0 Comments   842 Views
Here Mudassar Ahmed Khan has explained how to insert and retrieve images from SQL Server database without using Stored Procedures using C# and VB.Net.
25 Jul 2015
0 Comments   334 Views
Here Mudassar Ahmed Khan has explained with an example, how to populate (fill) DataTable and DataSet using DataReader (SqlDataReader) in C# and VB.Net.
The DataTable and DataSet will be populated with records from the DataReader using Load method of the DataTable.