h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->

Pages

Calling Constructor from another Constructor

Yes , it is possible. Please check this link

Constructor in C#.net

              A constructor is a method in the class which gets executed when its object is created. Usually, we put the initialization code in the constructor. 

Validate Text Box

Introduction:
      Today, we discussed about How to validate Text Box with Error Provider in C#.Net? .
Conditions:
    TextBox should enter only integer.
    create one validation event for integer

Here the Code:
protected void textBox1_Validating (object sender,
   System.ComponentModel.CancelEventArgs e)
{
   try
   {
      int x = Int32.Parse(textBox1.Text);
      errorProvider1.SetError(textBox1, "");
   }
   catch (Exception ex)
   {
      errorProvider1.SetError(textBox1, "Not an integer value.");
   }
}

Call this event in constructor
this.textBox1.Validating += new
System.ComponentModel.CancelEventHandler(this.textBox1_Validating);

Valdating data in Dataset

  • Validating data is the process of confirming that the values being entered into data objects conform to the constraints within a dataset's schema, as well as the rules established for your application.
  • Validating data prior to sending updates to the underlying database is a good practice that reduces errors as well as the potential number of round trips between an application and the database.
  • You can confirm that data being written to a dataset is valid by building validation checks into the dataset itself.
  • The dataset can check the data no matter how the update is being performed — whether directly by controls in a form, within a component, or in some other way. Because the dataset is part of your application, it is a logical place to build application-specific validation (unlike building the same checks into the database backend).


TableAdapter in Windows Application

TableAdapter Overview:

  1. TableAdapters provide communication between your application and a database.
  2. TableAdapters are also used to send updated data from your application back to the database.
  3. ADO.NET Data Adapters were used for communicating between an application and a       database.
  4. TableAdapters typically contain Fill and Update methods to fetch and update data in a database.
  5. TableAdapters are created with the Dataset Designer inside of strongly typed datasets. 




Fill a dataset with data

  • The phrase "filling a dataset with data" refers to loading data into the individual DataTable objects that make up the dataset.
  • You fill the data tables by executing TableAdapter queries or by executing data adapter (for example, SqlDataAdapter) commands.


Local Temp Table vs Global Temp Table

Local Temp Table vs Global Temp Table
S.NoParticularsLocal Temp TableGlobal Temp Table
1Available SQL Server session or connection (means single user) all SQL Server sessions or connections (means all the user).
2deleted These are automatically deleted when the session that created the tables has been closedThese can be created by any SQL Server connection user and these are automatically deleted when all the SQL Server connections have been closed.
3stared with signLocal temporary table name is stared with single hash ("#") sign.Global temporary table name is stared with double hash ("##") sign.

Object Oriented vs Object based Language

Object Oriented vs Object based Language
S.NoParticularsOOL[Object Oriented Language]OBL[Object Based Language]
1SupportAll Features of OOPSAll feature of OOPS
2Built ObjectNoYes
3LanguagesC,C#,JavaVB,Javascripts

ASP.Net Web API vs ASP.NET MVC

ASP.Net Web API vs ASP.NET MVC
S.No Particulars ASP.NET WebAPI ASP.NET MVC
1Create Web Appcreate full blown HTTP services with easy and simple way that returns only data not view.returns both views and data
2support content-negotiationYesNo
3returning dataJSON,XML or any other based upon the Accept header in the request and you don't worry about that.JSON format using JsonResult.
4request are mapped actions based on HTTP verbs mapped to actions name.
5assemblySystem.Web.HttpSystem.Web.Mvc
6mixed MVC and Web API controllerWeb API since boths are different.implement the authorization then you have to create two filters one for MVC

Split Web Page Extention using C#.Net

Split Web Page Extention using C#.Net
using System.Text.RegularExpressions;

string  splitWebPageExtension(string webPage, string extension,int idx)
        {

            Regex Splitter = new Regex(extension);
            String[] Parts = Splitter.Split(webPage);
            string st = Parts[idx];
            return st;
        }
     string webPage = "http://dotnettechrocks.blogspot.in/ ";
     string str = splitWebPageExtension(webPage, ".in", 0);
     MessageBox.Show(str);

Result :http://dotnettechrocks.blogspot