Friday

DataTable in C#

Introduction

DataTable is formed with rows and columns, it stored the data in the same way as stored others objects in C#.

Namespace

If we are dealing with DataTable in C# then we require to define following Namespace in our C# program.

using System;

using System.Data;

Here demonstrating to get columns name from a DataTable.

private void Get_Column_name()
{
            // Declare data table
            DataTable _ dtTC = new DataTable();
             
          // get column name using with foreach loop
           foreach(DataColumn _Cols in _dtTC.Columns)
            {
                string _str_Col_name = _Cols.ColumnName;
            }

}

DataTable In C#

Another method to select data from a specific DataTable in C#.

        private void Select_Data_From_Datatable_In_CSharp()
        {
            // Declare data table
            DataTable _dtSelectTC = new DataTable();

            // add column to data table
            _dtSelectTC.Columns.Add("ID", typeof(Int32));

            // adding rows to data table
            _dtSelectTC.Rows.Add(10);
            _dtSelectTC.Rows.Add(20);
            _dtSelectTC.Rows.Add(30);
            _dtSelectTC.Rows.Add(40);
            _dtSelectTC.Rows.Add(50);

            // filtering data on demand
            DataRow[] _resultTc = _dtSelectTC.Select("ID > 30");

            // Display results
            foreach (DataRow _rowTc in _resultTc)
            {
                Console.Write(_rowTc[0] + "\n");
            }

            // Output
            // 40
            // 50
        }

Conclusion

I have explained in detail about DataTable in C#, it uses system.Data to define DataTable and further uses of its properties, constraints etc. We can use “Clear “ method to clear data from DataTable, “Clone” helps us to cloning of a DataTable with structure and data, “Copy” copies its data with schema.

Suggested Reading:



Thursday

ArrayList in C#

Introduction

Today, I bet to throw light on ArrayList in C#. ArrayList has great feature because it can increase and decrease its size dynamically. ArrayList accepts also null value, moreover it allows to add duplicate values.

Namespace:

using System.Collections;
using System;

Saturday

MVC ASP.Net Interview Questions And Answers

In this article,  explaining best MVC ASP.Net Interview Questions and Answers as following:

1. Which is the best approach to assign a session in MVC?

A) System.Web.HttpContext.Current.Session["LoginID"] =7;
B) Current.Session["LoginID"] =7;
C) Session["LoginID"] =7;
D) None

2. RedirectToActionPermanent() Method for which Status code represents?

A) 304
B) 302
C) 301
D) 300
E) None

3. RedirectToAction() Method for which Status code represents?

A) 304
B) 302
C) 301
D) 300
E) None

Tuesday

How to Delete Contraints in SQL Server

Introduction

Suppose we are working with Entity Framework or some very complex database and moreover we don’t have matured database then very tedious work to carry out changes with our back end database in MS SQL Server, so I am proposing this great utility to handle out this problem.

Saturday

AngularJS JavaScript MVW Framework

Angular History:

AngularJS is quite new language and introduced first time in 2012, Google employee starts to develop it in 2009. Later Google properly take over, funded and full time development on it. Angular JS is easy to learn. It extends HTML with new modern rich features.

Angular JS

Master And Content Pages in ASP.Net

ASP.Net Master Page’s application allows us to create a consistent layout of the UI. We can create a master page in asp.net application; moreover can create multiple content pages where ever we can display content.
Master page has a extension with .Master

Tuesday

HTTP Error 403.14 - Forbidden in IIS

I am explaining in detail how to resolve issue HTTP Error 403.14 – Forbidden in IIS. Earlier, I have explained in detail about Login failed for user IIS Apppool \Default Apppool, HTTP Error 503. The service is unavailable.

Error Description:

HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.

Step 1: I was working on prominent website, and then I popped up a error in my browser HTTP Error 403.14 – Forbidden. The Web server is configured to not list the contents of this directory.