History of DotNet
.Net was originally known as the
NGWS (Next Generation Windows Services) which was said to be an Internet based
platform of Next Generation Windows Services. Before the official announcement
of .Net.
DOTNET FRAMEWORK
1) 1.0 (2002)
MDE – Visual Studio
×
ASP.NET
1.0
×
CLR
1.0
×
C#
1.0
×
VB.NET
7
×
NetFx
1.0
2) 1.1 (2003)
MDE – Visual Studio 2003
New
Features
×
Side
by Side Execution
×
.NET
Compact Framework
×
IP6
Support
×
API
Changes
Components
×
ASP.NET
1.1
×
CLR
1.1
×
C#1.1
×
VB.NET
7.1
×
NetFx
1.1
3) 2.0 (2005)
MDE – Visual Studio
2005
New Features
Components
×
ASP.NET
2.0
×
CLR
2.0
×
C#2.0
×
VB.NET
8.0
×
NetFx
2.0
×
ADO.NET
2.0
4) 3.0 (2006)
×
NetFx
3.0
×
WPF
×
WCF
×
WF
×
Windows
Cardspace
5) 3.5 (2007)
MDE – Visual Studio 2008
×
ASP.NET
3.5
×
CLR
2.0
×
C#
3.0
×
VB.NET
9
×
NetFx
3.5
6) 4.0 (2010)
×
Visual
Studio 2010
×
ASP.NET
4.0
×
CLR
4.0
CLR
×
1.0
×
1.1
×
2.0
×
4.0
ASP.NET
×
1.0
×
1.1
×
2.0
×
3.5
×
4.0
CSHARP
(C#)
×
1.0
×
1.1
×
2.0
1. Generics
2. Iterators
3. Partial Classes
4. Nullable Types
5. Anonymous Methods
6. Namespace alias qualifier
7.
Static
Classes
8.
External
Assembly Alias
1. Property Accessor Accessibility
2. Covariance and Contra variance in
Delegates
3. Friend Assemblies
4. Inline warning control
5. Volatile
×
3.0
1. LINQ
2. Object initializers
3. Collection initializers
4. Anonymous types
5. Local variable type inference
6. Lambda expressions
7. Expression trees
8. Automatic properties
1.
Extension
methods
2.
Partial
methods
×
4.0
VB.NET
×
7.0
×
7.1
×
8.0
×
9.0
Labels:
.Net Framework,
.Net Framework and Tools
Interview Question and Answer -- ADO.NET
1)Full form of ADO.NET?
ADO.NET -- Activex Data Object.
2)Explain DataProviders Which are available with .Net Framework?
.NET provider for SQL Server
.NET provider for ODBC
.NET Framework Data Provider for Oracle
.NET Framework Provider for OLEDB
.NET provider for SQL Server:
Enables .NET Application works with SQL Server 7.0 and latest Versions.
.NET provider for ODBC:
Enables .NET Application works with ODBC.
.NET Framework Data Provider for Oracle:
Enables .NET Application works with Oracle 8.1.7 and latest Versions.
.NET Framework Provider for OLEDB:
Enables .NET Application works with OLEDB Data Strcuture.
3) Properties of DataAdapter?
SelectCommand,Insertcommand,Updatecommand, DeleteCommand.
4) what are the Disadvantages of ADO.NET?
Managed Only Access.
Only Three Managed Data Providers.
Learning Curve
5) Difference between ADO Recordset and Dataset?
ADO Recordset :
One Row at an instatnt.
It needs an open connection to read the data from data source.
able to load the structure and data of only one data at a time.
It doesn't support constraints of Databases.
Dataset:
data structure which repersents complete table data at same time.
It needs connection only for retriving the data.After retrieve the data connection is not necessary.
Capability to store the structure and data of multiple tales at a time.
uses constraints object to enfoce data integrity by using contraints.
6)difference between Dataset and Datareader?
Dataset:
fetch data and appropriately store them in structured foramt.
use XML to repersent inline view of the relation data.
Single Object of dataset an biubd Multiple tables of a database.
disconnected architecture
Datareader:
It doesn't use as much objects as used by Dataset.
It doesn't present inline view of relational data by using XML tags.
single object of a datareader can access only one table at an instant.
connected architecture
7) Explain ExecuteReader?
ExecuteReader:
This Method returns an abject of a data reader such as SQLDataReader.
An Object of the Connection class must invoke open method to open the database before the object of command class can Execute "Executereader" method.
8) Explain ExecuteNonQuery?
ExecuteNonQuery:
This method an integer which represents the number of rows that are effected by SQL Query executed by the object of commnd class.
9)Explain ExecuteScalar?
ExecuteScalar:
This methnod returns a single value from a datasoruce.
10)Concepts of DataAdapter?
Bridge between Dataset and Database.
11)Various methods provideed by the dataset object to generate XML?
ReadXML
GeTXML
WriteXML
ADO.NET -- Activex Data Object.
2)Explain DataProviders Which are available with .Net Framework?
.NET provider for SQL Server
.NET provider for ODBC
.NET Framework Data Provider for Oracle
.NET Framework Provider for OLEDB
.NET provider for SQL Server:
Enables .NET Application works with SQL Server 7.0 and latest Versions.
.NET provider for ODBC:
Enables .NET Application works with ODBC.
.NET Framework Data Provider for Oracle:
Enables .NET Application works with Oracle 8.1.7 and latest Versions.
.NET Framework Provider for OLEDB:
Enables .NET Application works with OLEDB Data Strcuture.
3) Properties of DataAdapter?
SelectCommand,Insertcommand,Updatecommand, DeleteCommand.
4) what are the Disadvantages of ADO.NET?
Managed Only Access.
Only Three Managed Data Providers.
Learning Curve
5) Difference between ADO Recordset and Dataset?
ADO Recordset :
One Row at an instatnt.
It needs an open connection to read the data from data source.
able to load the structure and data of only one data at a time.
It doesn't support constraints of Databases.
Dataset:
data structure which repersents complete table data at same time.
It needs connection only for retriving the data.After retrieve the data connection is not necessary.
Capability to store the structure and data of multiple tales at a time.
uses constraints object to enfoce data integrity by using contraints.
6)difference between Dataset and Datareader?
Dataset:
fetch data and appropriately store them in structured foramt.
use XML to repersent inline view of the relation data.
Single Object of dataset an biubd Multiple tables of a database.
disconnected architecture
Datareader:
It doesn't use as much objects as used by Dataset.
It doesn't present inline view of relational data by using XML tags.
single object of a datareader can access only one table at an instant.
connected architecture
7) Explain ExecuteReader?
ExecuteReader:
This Method returns an abject of a data reader such as SQLDataReader.
An Object of the Connection class must invoke open method to open the database before the object of command class can Execute "Executereader" method.
8) Explain ExecuteNonQuery?
ExecuteNonQuery:
This method an integer which represents the number of rows that are effected by SQL Query executed by the object of commnd class.
9)Explain ExecuteScalar?
ExecuteScalar:
This methnod returns a single value from a datasoruce.
10)Concepts of DataAdapter?
Bridge between Dataset and Database.
11)Various methods provideed by the dataset object to generate XML?
ReadXML
GeTXML
WriteXML
Adjust Width CheckBoxList using C#.net
private void checkBoxlistWidht(CheckedListBox chk)
{
System.Drawing.Graphics g = chk.CreateGraphics();
float maxwidth = 0f;
foreach (object o in chk.Items)
{
float w = g.MeasureString(o.ToString(), chk.Font).Width;
if (w > maxwidth)
maxwidth = w;
}
g.Dispose();
chk.Width = (int)maxwidth + 30;
}
{
System.Drawing.Graphics g = chk.CreateGraphics();
float maxwidth = 0f;
foreach (object o in chk.Items)
{
float w = g.MeasureString(o.ToString(), chk.Font).Width;
if (w > maxwidth)
maxwidth = w;
}
g.Dispose();
chk.Width = (int)maxwidth + 30;
}
Labels:
C#.Net
Adjust width of DateTimepicker
Today , we will discuss about How to adjust width of DateTimepicker in C#.Net.
Now, let’s start:
Create Project in VS 2008 .
Open your form
Drag and Drop DateTimePicker from Toolbar into Form
Go To Code Section .
Copy and Paste the following code in the Code section .
Happy Coding!
Now, let’s start:
Create Project in VS 2008 .
Open your form
Drag and Drop DateTimePicker from Toolbar into Form
Go To Code Section .
Copy and Paste the following code in the Code section .
private void dateTimePickerwidth(DateTimePicker dtp,string format)
{
System.Drawing.Graphics g = dtp.CreateGraphics();
float maxwidth = 0f;
float w = g.MeasureString(Convert.ToString(dtp), dtp.Font).Width;
if (w < maxwidth)
maxwidth = w;
g.Dispose();
switch (format)
{
case "Long":
dtp.Width = (int)maxwidth + 220;
break;
case "Short":
dtp.Width = (int)maxwidth + 100;
break;
case "Time":
dtp.Width = (int)maxwidth + 100;
break;
case "Custom":
dtp.Width = (int)maxwidth + 105;
break;
}
{
System.Drawing.Graphics g = dtp.CreateGraphics();
float maxwidth = 0f;
float w = g.MeasureString(Convert.ToString(dtp), dtp.Font).Width;
if (w < maxwidth)
maxwidth = w;
g.Dispose();
switch (format)
{
case "Long":
dtp.Width = (int)maxwidth + 220;
break;
case "Short":
dtp.Width = (int)maxwidth + 100;
break;
case "Time":
dtp.Width = (int)maxwidth + 100;
break;
case "Custom":
dtp.Width = (int)maxwidth + 105;
break;
}
}
private void Form1_Load(object sender, EventArgs e)
{
dateTimePickerwidth(dateTimePicker1, dateTimePicker1.Format.ToString());
}
Run the Application and See the Result.{
dateTimePickerwidth(dateTimePicker1, dateTimePicker1.Format.ToString());
}
Happy Coding!
Labels:
C#.Net
Get week number of the Day using C#
int noofweek = DateTime.Today.DayOfYear;
noofweek = noofweek/7;
MessageBox.Show(noofweek.ToString());
noofweek = noofweek/7;
MessageBox.Show(noofweek.ToString());
Labels:
C#.Net
Display Accounting Year of India
Indian Financial Year using C#.Net .
Indian Financial Year Starts with 01/04/yyyy To 31/03//yyyy.
lstAccountYear(2010);
CurrentYear :2013
if Current date:01/04/2013
Result :
2010-2011
2011-2012
2012-2013
2013-2014
else Current date:31/03/2013
2010-2011
2011-2012
2012-2013
Indian Financial Year Starts with 01/04/yyyy To 31/03//yyyy.
private static string CurrentDate;
public static string SplitDay(DateTime dtp,string Mode)
{
string str = Convert.ToString(dtp);
String.Format("{0:MM/dd/yyyy}", dtp);
string[] st = str.Split('/');
switch (Mode)
{
case "Day":
CurrentDate = st[1];
break;
case "Month":
CurrentDate = st[0];
break;
case "Year":
CurrentDate = st[2];
string[] s = CurrentDate.Split(' ');
CurrentDate = s[0];
break;
}
return CurrentDate;
}
public static string SplitDay(DateTime dtp,string Mode)
{
string str = Convert.ToString(dtp);
String.Format("{0:MM/dd/yyyy}", dtp);
string[] st = str.Split('/');
switch (Mode)
{
case "Day":
CurrentDate = st[1];
break;
case "Month":
CurrentDate = st[0];
break;
case "Year":
CurrentDate = st[2];
string[] s = CurrentDate.Split(' ');
CurrentDate = s[0];
break;
}
return CurrentDate;
}
private void lstAccountYear(int statringYear)
{
string Day = ClsFinancialYear.SplitDay(DateTime.Now, "Day");
string Month = ClsFinancialYear.SplitDay(DateTime.Now, "Month");
string Year = ClsFinancialYear.SplitDay(DateTime.Now, "Year");
int NextYear = Convert.ToInt32(Year) + 1;
int LastYear = Convert.ToInt32(Year) - 1;
int CurrentYear = Convert.ToInt32(Year);
if (Convert.ToInt32(Month) <= 3 && Convert.ToInt32(Year) == LastYear + 1)
{
for (int stYear = statringYear; stYear < CurrentYear; stYear++)
{
int next = stYear + 1;
listBox1.Items.Add(stYear + "-" + next);
listBox1.SelectedIndex = listBox1.Items.Count - 1;
}
}
else
{
for (int stYear = statringYear; stYear < NextYear ; stYear++)
{
int next = stYear + 1;
listBox1.Items.Add(stYear + "-" + next);
listBox1.SelectedIndex = listBox1.Items.Count - 1;
}
}
}
Call this function in Form_load (where you want){
string Day = ClsFinancialYear.SplitDay(DateTime.Now, "Day");
string Month = ClsFinancialYear.SplitDay(DateTime.Now, "Month");
string Year = ClsFinancialYear.SplitDay(DateTime.Now, "Year");
int NextYear = Convert.ToInt32(Year) + 1;
int LastYear = Convert.ToInt32(Year) - 1;
int CurrentYear = Convert.ToInt32(Year);
if (Convert.ToInt32(Month) <= 3 && Convert.ToInt32(Year) == LastYear + 1)
{
for (int stYear = statringYear; stYear < CurrentYear; stYear++)
{
int next = stYear + 1;
listBox1.Items.Add(stYear + "-" + next);
listBox1.SelectedIndex = listBox1.Items.Count - 1;
}
}
else
{
for (int stYear = statringYear; stYear < NextYear ; stYear++)
{
int next = stYear + 1;
listBox1.Items.Add(stYear + "-" + next);
listBox1.SelectedIndex = listBox1.Items.Count - 1;
}
}
}
lstAccountYear(2010);
CurrentYear :2013
if Current date:01/04/2013
Result :
2010-2011
2011-2012
2012-2013
2013-2014
else Current date:31/03/2013
2010-2011
2011-2012
2012-2013
Labels:
C#.Net
Split date from DateTime in C#.Net
private static string CurrentDate;
public static string SplitDay(DateTime dtp,string Mode)
{
string str = Convert.ToString(dtp);
String.Format("{0:MM/dd/yyyy}", dtp);
string[] st = str.Split('/');
switch (Mode)
{
case "Day":
CurrentDate = st[1];
break;
case "Month":
CurrentDate = st[0];
break;
case "Year":
CurrentDate = st[2];
string[] s = CurrentDate.Split(' ');
CurrentDate = s[0];
break;
}
return CurrentDate;
}
public static string SplitDay(DateTime dtp,string Mode)
{
string str = Convert.ToString(dtp);
String.Format("{0:MM/dd/yyyy}", dtp);
string[] st = str.Split('/');
switch (Mode)
{
case "Day":
CurrentDate = st[1];
break;
case "Month":
CurrentDate = st[0];
break;
case "Year":
CurrentDate = st[2];
string[] s = CurrentDate.Split(' ');
CurrentDate = s[0];
break;
}
return CurrentDate;
}
Labels:
C#.Net
Compare Two ArrayList with DateTime
private static ArrayList list1 = new ArrayList(new DateTime[] { Convert.ToDateTime("2010-12-01"), Convert.ToDateTime("2010-12-11"), Convert.ToDateTime("2010-12-21") });
private static ArrayList list2 = new ArrayList(new DateTime[] { Convert.ToDateTime("2010-12-01"), Convert.ToDateTime("2010-12-15") });
private static int CountofList1 = list1.Count;
private static int CountofList2 = list2.Count;
private static void CompareDatewithArrayList(string Comp)
{
switch (Comp)
{
case "1":
if (CountofList1 > CountofList2)
{
foreach (DateTime str in list1)
{
if (!list2.Contains(str))
{
MessageBox.Show(Convert.ToString(str));
}
}
}
else if (CountofList1 == CountofList2)
{
foreach (DateTime str in list1)
{
if (!list2.Contains(str))
{
MessageBox.Show(Convert.ToString(str));
}
}
}
else
{
foreach (DateTime str in list1)
{
if (!list2.Contains(str))
{
MessageBox.Show(Convert.ToString(str));
}
}
}
break;
case "2":
if (CountofList1 > CountofList2)
{
foreach (DateTime str in list2)
{
if (!list1.Contains(str))
{
MessageBox.Show(Convert.ToString(str));
}
}
}
else if (CountofList1 == CountofList2)
{
foreach (DateTime str in list2)
{
if (!list1.Contains(str))
{
MessageBox.Show(Convert.ToString(str));
}
}
}
else
{
foreach (DateTime str in list2)
{
if (!list1.Contains(str))
{
MessageBox.Show(Convert.ToString(str));
}
}
}
break;
}
}
private static ArrayList list2 = new ArrayList(new DateTime[] { Convert.ToDateTime("2010-12-01"), Convert.ToDateTime("2010-12-15") });
private static int CountofList1 = list1.Count;
private static int CountofList2 = list2.Count;
private static void CompareDatewithArrayList(string Comp)
{
switch (Comp)
{
case "1":
if (CountofList1 > CountofList2)
{
foreach (DateTime str in list1)
{
if (!list2.Contains(str))
{
MessageBox.Show(Convert.ToString(str));
}
}
}
else if (CountofList1 == CountofList2)
{
foreach (DateTime str in list1)
{
if (!list2.Contains(str))
{
MessageBox.Show(Convert.ToString(str));
}
}
}
else
{
foreach (DateTime str in list1)
{
if (!list2.Contains(str))
{
MessageBox.Show(Convert.ToString(str));
}
}
}
break;
case "2":
if (CountofList1 > CountofList2)
{
foreach (DateTime str in list2)
{
if (!list1.Contains(str))
{
MessageBox.Show(Convert.ToString(str));
}
}
}
else if (CountofList1 == CountofList2)
{
foreach (DateTime str in list2)
{
if (!list1.Contains(str))
{
MessageBox.Show(Convert.ToString(str));
}
}
}
else
{
foreach (DateTime str in list2)
{
if (!list1.Contains(str))
{
MessageBox.Show(Convert.ToString(str));
}
}
}
break;
}
}
Labels:
C#.Net
Pass TextBox Values into another form ComboBox in C#.net
Today ,we will discuss about Pass One control Value to another Form in C#.net.
· Create a Project in VS 2008.
· Create Two Form .Form 1 and Form2.
· Create TextBoxes and One Button on Form1.
· Rename name the TextBox .Start with txt.
· Create ComboBox on Form2.
Now , we will go to Our scenario.
Copy and Paste the following codes in Form 1 Code View Section
public static string[] textvalues;
List values = new List();
private void button1_Click(object sender, EventArgs e)
{
foreach (Control con in this.Controls)
{
if (con.Name.StartsWith("txt"))
{
values.Add(con.Text);
}
}
textvalues = values.ToArray();
Form2 frm = new Form2();
frm.Show();
}
Copy and Paste the following codes in Form 2 Code View Section
private void Form2_Load(object sender, EventArgs e)
{
comboBox1.Items.Clear();
foreach (string str in Form1.textvalues)
{
comboBox1.Items.Add(str);
}
}
Just Run the Application and Enter the values and click Button1 .
Labels:
C#.Net