Dot Net Lab Manual1
Dot Net Lab Manual1
2 Program to display the first 10 natural numbers and their sum using
console application.
4 Write a program to convert input string from lower to upper and upper to
lower case.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Add_Sub_Mul_Div
{
class Program
{
int a = 10, b = 4;
}
}
Output :
Questions :
1. What is the Console.WriteLine() function?
Q.2 Program to display the first 10 natural numbers and their sum using console
application.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace First_Ten_No
{
class Program
{
int s = 0;
Console.WriteLine(i);
s = s + i;
}
Console.WriteLine("Sum of Numbers = {0}", s);
}
}
}
Output :
Q.3 Program to display the addition using the windows application.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Addition
{
public Form1()
{
InitializeComponent();
}
Output :
Questions :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter a string in lower case :");
string s1 = Console.ReadLine();
}
}
}
Output :
Questions :
1. What is the Console.ReadLine() function?
namespace Calculator
{
public partial class Form1 : Form
{
string m1, m3, m5, m7, m9;
int x;
public Form1()
{
InitializeComponent();
}
}
}
}
Output :
Q. 6 Write a program working with Page using ASP.Net.
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("Next Page.aspx");
}
}
Output :
Questions :
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
}
protected void Button1_Click(object sender, EventArgs e)
{
if (RadioButton1.Checked)
Label3.Text = "Hello Mr." + TextBox1.Text;
else if (RadioButton2.Checked)
Label3.Text = "Hello Ms. " + TextBox1.Text;
}
}
Output :
Questions :
1. What is a ASP.NET.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace Oracle_form
{
public partial class Form1 : Form
{
OleDbConnection con = new OleDbConnection
("Provider=MSDAORA; User Id=System; Password=manager");
public Form1()
{
InitializeComponent();
}
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show(s);
cmd.CommandText = s;
cmd.ExecuteNonQuery();
MessageBox.Show("Information Inserted");
textBox1.Clear();
textBox2.Clear();
string s1 = Session["rollno"].ToString();
string s2 = Session["sem"].ToString();
string s3 = Session["branch"].ToString();
string d1 = dr.GetValue(0).ToString();
string d2 = dr.GetValue(1).ToString();
string d3 = dr.GetValue(2).ToString();
string d4 = dr.GetValue(3).ToString();
string d5 = dr.GetValue(4).ToString();
string d6 = dr.GetValue(5).ToString();
string d7 = dr.GetValue(6).ToString();
string d8 = dr.GetValue(7).ToString();
TextBox1.Text = d1;
TextBox2.Text = d2;
TextBox3.Text = d3;
Label16.Text = d4;
Label17.Text = d5;
Label18.Text = d6;
Label19.Text = d7;
Label20.Text = d8;
dr.Dispose();
}
cmd1.CommandText = "select * from SEM_BRANCH_SUB where
sem='"+s2+"' and branch='"+s3+"' ";
OleDbDataReader dr1 = cmd1.ExecuteReader();
if (dr1.Read())
{
string d9 = dr1.GetValue(2).ToString();
string d10 = dr1.GetValue(3).ToString();
Label10.Text = d9;
Label11.Text = d10;
Label12.Text = d11;
Label13.Text = d12;
Label14.Text = d13;
}
}
}
Questions :
1. What is a ADO.NET.
Session["ename"] = TextBox1.Text;
Session["eaddress"] = TextBox2.Text;
Response.Redirect("Default2.aspx");
}
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = Session.SessionID.ToString();
Session["eage"] = TextBox1.Text;
Session["esalary"] = TextBox2.Text;
Response.Redirect("Default3.aspx");
}
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
Label1.Text = Session.SessionID.ToString();
TextBox1.Text = Session["ename"].ToString();
TextBox2.Text = Session["eaddress"].ToString();
TextBox3.Text = Session["eage"].ToString();
TextBox4.Text = Session["esalary"].ToString();
Questions :