C# Lab Record2023-1
C# Lab Record2023-1
STUDENT NAME
REGISTER NUMBER
DEPARTMENT OF COMPUTER APPLICATIONS
BONAFIDE CERTIFICATE
PAGE
SNO DATE EXPERIMENTS TOPIC SIGNATURE
NO
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
Exercise – 1: Write a program to implement multilevel inheritance. Accept and display data for one
student.
Class : student Data Members : Roll_no , name
Class : Test Data Members : marks1 , marks2
Class : Result Data Members : total
Aim:
Algorithm:
Program:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Ex1
{
public class student
{
protected int Roll_no;
protected string name;
}
class Program
{
static void Main(string[] args)
{
Result s1 = new Result();
s1.getDetails();
s1.showDetails();
Console.ReadLine();
}
}
}
Output:
Result:
Exercise – 2: Demonstrate Use of Virtual and override keyword in C# with a simple Program.
Aim:
Algorithm:
Program:
Program;
using System;
namespace VirtualExample
{
class Shape
{
public double length=0.0;
public double width =0.0;
public double radius =0.0;
Aim:
Algorithm:
Form Design:
Program:
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 CalculatorApp
{
public partial class Form1 : Form
{
double FirstNumber;
string Operation;
public Form1()
{
InitializeComponent();
}
}
private void nequal_Click(object sender, EventArgs e)
{
double SecondNumber;
double Result;
SecondNumber = Convert.ToDouble(textBox1.Text);
if (Operation == "+")
{
Result = (FirstNumber + SecondNumber);
textBox1.Text = Convert.ToString(Result);
FirstNumber = Result;
}
if (Operation == "-")
{
Result = (FirstNumber - SecondNumber);
textBox1.Text = Convert.ToString(Result);
FirstNumber = Result;
}
if (Operation == "*")
{
Result = (FirstNumber * SecondNumber);
textBox1.Text = Convert.ToString(Result);
FirstNumber = Result;
}
if (Operation == "/")
{
if (SecondNumber == 0)
{
textBox1.Text = "Cannot divide by zero";
}
else
{
Result = (FirstNumber / SecondNumber);
textBox1.Text = Convert.ToString(Result);
FirstNumber = Result;
}
}
}
}
}
Output:
Result:
Exercise – 4: CONSIDER the dataset student consisting of following tables:
tbl_course(courseID:int, coursename:string)
tbl_student(usn:string, studname:String, Address: String , Courseid: int, yrofadmsn:int)
Develop suitable windows applications using C#.Net having following options:
Aim:
Algorithm:
Form Designs:
Program :
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;
using System.Data.SqlClient;
namespace WindowsFormsApplication4
{
public partial class Form1 : Form {
SqlConnection con = new SqlConnection("Data Source=DESKTOPFOF4B0D\\
SQLEXPRESS;Initial Catalog=master;Integrated Security=True");
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd=new SqlCommand("insert into TBL_COURSE values(" +
textBox1.Text +",'"+ textBox2.Text + "')",con);
cmd.ExecuteNonQuery();
MessageBox.Show("New Course Entered");
con.Close();
}
private void button2_Click(object sender, EventArgs e)
{
con.Open();
SqlDataAdapter da=new SqlDataAdapter("select * from
TBL_COURSE",con);
DataTable dt= new DataTable();
da.Fill(dt);
dataGridView1.DataSource=dt;
con.Close( );
}
private void button3_Click(object sender, EventArgs e)
{
this.Close();
}
private void button4_Click(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
}
}
}
Output :
Result:
Exercise – 5: Consider the above dataset student. Develop suitable windows application using
C#.Net
a) Enter he Student details.
b) Display the details the student who have taken admission in a particular year.
.
Aim:
Algorithm:
Form Design:
Program:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication5
{
public partial class Form1 : Form
{
SqlConnection con = new SqlConnection("Data Source=DESKTOPFOF4B0D\\SQLEXPRESS;Initial
Catalog=master;Integrated Security=True");
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("select COURSE_ID from
TBL_COURSE", con);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
comboBox1.Items.Add(dr[0].ToString());
}
con.Close();
}
private void button1_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd=new SqlCommand ("insert into TBL_STUDENT
values('"+textBox1.Text+ "','"+textBox2.Text +"','"+textBox3.Text+"',"+
comboBox1.Text+ ","+ textBox4.Text +")",con);
cmd.ExecuteNonQuery();
MessageBox.Show("New Student Entered");
con.Close();
}
private void button3_Click(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
comboBox1.Text = "";
}
private void button4_Click(object sender, EventArgs e)
{
this.Close();
}
private void button2_Click(object sender, EventArgs e)
{
dis d = new dis();
d.Show();
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data.SqlClient;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication5
{
public partial class dis : Form
{
SqlConnection con = new SqlConnection("Data Source=DESKTOPFOF4B0D\\SQLEXPRESS;Initial
Catalog=master;Integrated Security=True");
public dis()
{
InitializeComponent();
}
private void dis_Load(object sender, EventArgs e)
{
con.Open();
SqlCommand cmd = new SqlCommand("select distinct(YR_OF_AD) from
TBL_STUDENT", con);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
comboBox1.Items.Add(dr[0].ToString());
}
con.Close();
}
Output:
Result:
Exercise – 6 : Create the application using ASP.Net server controls that accepts name,
password,age,E-Mail id and User id. All the information entry is compulsory. Password should
be reconfirmed. Age should be within 21 to 30. Email id should be valid. User should have
atleast a capital letter and digit as well as length should be between 7 and 20 characters.
Aim:
Algorithm:
Program:
Default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<style type="text/css">
.style1
{
font-size: xx-large;
font-weight: bold;
color: #FF66CC;
text-align: center;
}
.style2
{
width: 500px;
text-align: center;
}
.style5
{
font-size: x-large;
text-align: center;
}
.style6
{
font-size: x-large;
text-align: right;
}
</style>
</head>
<body>
</html>
Default.aspx.cs
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;
int charCnt = 0;
int numCnt = 0;
Aim:
Algorithm:
Form Designs.
Master page
<%@MasterLanguage="C#"AutoEventWireup="true"CodeFile="MasterPage.master.cs"Inher
its="MasterPa ge"%>
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title></title>
<styletype="text/css">
.style1
{
text-align: center;
}
.style2
{
font-family: Arial,Helvetica,sans-serif;
}
.style3
{
font-family: Arial,Helvetica,sans-serif; color: #990000;
}
.style4
{
color: #990000;
}
</style>
</head>
<body>
<formid="form1"runat="server">
<%@PageTitle=""Language="C#"MasterPageFile="~/MasterPage.master"AutoEventWireup
="true"CodeFil e="NewBankEntry.aspx.cs"Inherits="NewBankEntry"%>
<asp:ContentID="Content1"ContentPlaceHolderID="head"Runat="Server">
<h2class="style1"style="color: #FF0000">New Bank Entry</h2>
<fieldset>
<tablestyle="width: 59%; height: 96px;"border="0"align="center">
<tr>
<tdstyle="width: 810px; text-align: right"> Bank ID</td>
<tdstyle="width: 578px">
<asp:TextBoxID="TextBox1"runat="server"Width="200px"></asp:TextBox>
</td>
</tr>
<tr>
<tdstyle="width: 810px; text-align: right">
Bank Name</td>
<tdstyle="width: 578px">
<asp:TextBoxID="TextBox2"runat="server"Width="200px"></asp:TextBox>
</td>
</tr>
<tr>
<tdstyle="width: 810px"> </td>
<tdstyle="width: 578px"> </td>
</tr>
<tr>
<tdstyle="width: 810px"> </td>
<tdstyle="width: 578px">
<asp:ButtonID="Button1"runat="server"Text="Submit"Width="100px" style="color:
#FF0000"onclick="Button1_Click"/>
</td>
</tr>
</table>
</fieldset>
</asp:Content>
Aspx code:
using System;
using System.Collections.Generic; using System.Linq;
using System.Web; using System.Web.UI;
using System.Web.UI.WebControls; using System.Data.SqlClient;
publicpartialclassNewBankEntry : System.Web.UI.Page
{
protectedvoid Page_Load(object sender, EventArgs e)
{
}
protectedvoid Button1_Click(object sender, EventArgs e)
{
SqlConnection con = newSqlConnection("Data Source=DHANANJAY-PC;Initial
Catalog=bankDB;User ID=sa;Password=123;Pooling=False");
con.Open();
string query = "insert into tbl_Bank(BankID,BankName)
values("+TextBox1.Text+",'"+TextBox2.Text+"')"; SqlCommand cmd =
newSqlCommand(query,con);
int i = cmd.ExecuteNonQuery(); if (i > 0)
{
Response.Write("<script language='javascript'>alert('insertion successful')</script>");
}
else
{
Response.Write("<script language='javascript'>alert('insertion
failed')</script>");
}
TextBox1.Text = ""; TextBox2.Text = "";
}
}
<%@PageTitle=""Language="C#"MasterPageFile="~/MasterPage.master"AutoEventWireup
="true"CodeFil e="NewBranchEntry.aspx.cs"Inherits="NewBranchEntry"%>
<asp:ContentID="Content1"ContentPlaceHolderID="head"Runat="Server">
<h1>
 
; &nbs
p; &n bsp;
<spanstyle="color: #FF0000">New Branch Entry</span></h1>
<fieldset>
<tablestyle="width: 75%"align="center">
<tr>
<tdstyle="width: 159px; text-align: right;"> Branch ID</td>
<tdstyle="width: 474px">
<asp:TextBoxID="TextBox1"runat="server"Width="200px"Height="25px"></asp:TextBox>
</td>
</tr>
<tr>
<tdstyle="width: 159px; text-align: right;"> Bank ID</td>
<tdstyle="width: 474px">
<asp:DropDownListID="DropDownList1"runat="server"Width="200px"Height="25px"
DataSourceID="SqlDataSource1"DataTextField="BankID"DataValueField="BankID">
<asp:ListItem>Select Bank ID</asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSourceID="SqlDataSource1"runat="server" ConnectionString="<%$
ConnectionStrings:bankDBConnectionString %>" SelectCommand="SELECT [BankID]
FROM [tbl_Bank]"></asp:SqlDataSource>
</td>
</tr>
<tr>
<tdstyle="width: 159px; text-align: right;"> Branch Name</td>
<tdstyle="width: 474px">
<asp:TextBoxID="TextBox2"runat="server"Width="200px"Height="25px"></asp:TextBox>
</td>
</tr>
<tr>
<tdstyle="width: 159px; text-align: right;"> </td>
<tdstyle="width: 474px"> </td>
</tr>
<tr>
<tdstyle="width: 159px; text-align: right;"> </td>
<tdstyle="width: 474px">
&nbs
p;
<asp:ButtonID="Button1"runat="server"Text="Submit"BackColor="Red"
Width="100px"onclick="Button1_Click"/>
</td>
</tr>
</table>
</fieldset>
</asp:Content>
Aspx code:
using System;
using System.Collections.Generic; using System.Linq;
using System.Web; using System.Web.UI;
using System.Web.UI.WebControls; using System.Data.SqlClient;
publicpartialclassNewBranchEntry : System.Web.UI.Page
{
protectedvoid Page_Load(object sender, EventArgs e)
{
}
protectedvoid Button1_Click(object sender, EventArgs e)
{
SqlConnection con = newSqlConnection("Data Source=DHANANJAY-PC;Initial
Catalog=bankDB;User ID=sa;Password=123;Pooling=False");
con.Open();
string query = "insert into tbl_Branch(BranchID,BankID,BranchName) values(" +
TextBox1.Text + ","+DropDownList1.SelectedValue+",'" + TextBox2.Text + "')";
SqlCommand cmd = newSqlCommand(query, con); int i = cmd.ExecuteNonQuery();
if (i > 0)
{
else
{
Response.Write("<script language='javascript'>alert('insertion
failed')</script>");
}
TextBox1.Text = ""; TextBox2.Text = "";
}
}
New Customer Entry Design code:
<%@PageTitle=""Language="C#"MasterPageFile="~/MasterPage.master"AutoEventWireup
="true"CodeFil e="NewCustomerEntry.aspx.cs"Inherits="NewCustomerEntry"%>
<asp:ContentID="Content1"ContentPlaceHolderID="head"Runat="Server">
<h1style="color:
#FF0000"> &
nbsp;
&nbs
p; &nb sp; New
Customer Entry</h1>
<fieldset>
<tablealign="center"style="width: 78%">
<tr>
<tdstyle="width: 219px; text-align: right; color: #FF0000;">
<b>Account Number:</b></td>
<tdstyle="width: 363px">
<asp:TextBoxID="TextBox_acc"runat="server"Width="200px"Height="25px"></asp:TextBo
x>
</td>
</tr>
<tr>
<tdstyle="width: 219px; text-align: right; color: #FF0000;">
<b>Bank ID:</b></td>
<tdstyle="width: 363px">
<asp:DropDownListID="DropDownList_bid"runat="server"Width="200px"
Height="25px"DataSourceID="SqlDataSource1"DataTextField="BankID"
DataValueField="BankID">
</asp:DropDownList>
<asp:SqlDataSourceID="SqlDataSource1"runat="server" ConnectionString="<%$
ConnectionStrings:bankDBConnectionString %>" SelectCommand="SELECT [BankID]
FROM [tbl_Bank]"></asp:SqlDataSource>
</td>
</tr>
<tr>
<tdstyle="width: 219px; text-align: right; color: #FF0000;">
<b>Branch ID:</b></td>
<tdstyle="width: 363px">
<asp:DropDownListID="DropDownList_brachId"runat="server"Width="200px"
Height="25px"DataSourceID="SqlDataSource2"DataTextField="BranchID"
DataValueField="BranchID">
</asp:DropDownList>
<asp:SqlDataSourceID="SqlDataSource2"runat="server" ConnectionString="<%$
ConnectionStrings:bankDBConnectionString %>" SelectCommand="SELECT [BranchID]
FROM [tbl_Branch]"></asp:SqlDataSource>
</td>
</tr>
<tr>
<tdstyle="width: 219px; text-align: right; color: #FF0000;">
<b>Customer Name:</b></td>
<tdstyle="width: 363px">
<asp:TextBoxID="TextBox_custnm"runat="server"Width="200px"Height="25px"></asp:Tex
tBox>
</td>
</tr>
<tr>
<tdstyle="width: 219px; text-align: right; color: #FF0000;">
<b>Address:</b></td>
<tdstyle="width: 363px">
<asp:TextBoxID="TextBox_add"runat="server"Width="200px"Height="25px"></asp:TextBo
x>
</td>
</tr>
<tr>
<tdstyle="width: 219px; text-align: right; color: #FF0000;">
<b>Contact No:</b></td>
<tdstyle="width: 363px">
<asp:TextBoxID="TextBox_Con"runat="server"Width="200px"Height="25px"></asp:TextB
ox>
</td>
</tr>
<tr>
<tdstyle="width: 219px; text-align: right; color: #FF0000;">
<b>Balance:</b></td>
<tdstyle="width: 363px">
<asp:TextBoxID="TextBox_bal"runat="server"Width="200px"Height="25px"></asp:TextBo
x>
</td>
</tr>
<tr>
<tdstyle="width: 219px; text-align: right; color: #FF0000;"> </td>
<tdstyle="width: 363px"> </td>
</tr>
<tr>
<tdstyle="width: 219px; text-align: right; color: #FF0000;"> </td>
<tdstyle="width: 363px">
&nbs
p;
<asp:ButtonID="Button1"runat="server"BackColor="Red"Text="Submit"
Width="100px"onclick="Button1_Click"/>
</td>
</tr>
</table>
</fieldset>
</asp:Content>
Aspx Code:
using System;
using System.Collections.Generic; using System.Linq;
using System.Web; using System.Web.UI;
using System.Web.UI.WebControls; using System.Data.SqlClient;
publicpartialclassNewCustomerEntry : System.Web.UI.Page
{
protectedvoid Button1_Click(object sender, EventArgs e)
{
SqlConnection con = newSqlConnection("Data Source=DHANANJAY-PC;Initial
Catalog=bankDB;User ID=sa;Password=123;Pooling=False");
con.Open();
string query = "insert into
tbl_Account(AccountNo,BankID,BranchID,CustomerName,Address,ContactNo,Balance)
values("+TextBox_acc.Text+","+DropDownList_bid.SelectedValue+","+DropDownList_brac
hId.Selecte
dValue+",'"+TextBox_custnm.Text+"','"+TextBox_add.Text+"',"+TextBox_Con.Text+","+Te
xtBox_bal. Text+")";
SqlCommand cmd = newSqlCommand(query, con); int i = cmd.ExecuteNonQuery();
if (i > 0)
{
Response.Write("<script language='javascript'>alert('insertion successful')</script>");
}
else
{
Response.Write("<script language='javascript'>alert('insertion
failed')</script>");
}
TextBox_acc.Text = ""; TextBox_custnm.Text = ""; TextBox_add.Text = "";
TextBox_Con.Text = ""; TextBox_bal.Text = "";
}
}
<%@PageTitle=""Language="C#"MasterPageFile="~/MasterPage.master"AutoEventWireup
="true"CodeFil
e="DisplayAllRecordOfBank.aspx.cs"Inherits="DisplayAllRecordOfBank"%>
<asp:ContentID="Content1"ContentPlaceHolderID="head"Runat="Server">
<h1>
 
; Display All Record of Particular Bank</h1>
<asp:LabelID="Label1"runat="server"
style="font-weight: 700; text-align: right; color: #FF0000" Text="Select The
Bank"></asp:Label>
:<asp:DropDownListID="DropDownList1"runat="server"AutoPostBack="True"onselectedind
exchanged=" DropDownList1_SelectedIndexChanged"
>
</asp:DropDownList>
<br/>
<br/>
<br/>
<asp:GridViewID="GridView_details"runat="server"BackColor="White"
BorderColor="#CC9966"BorderStyle="None"BorderWidth="1px"CellPadding="4"
style="text-align: center"Width="380px">
<FooterStyleBackColor="#FFFFCC"ForeColor="#330099"/>
<HeaderStyleBackColor="#990000"Font-Bold="True"ForeColor="#FFFFCC"/>
<PagerStyleBackColor="#FFFFCC"ForeColor="#330099"HorizontalAlign="Center"/>
<RowStyleBackColor="White"ForeColor="#330099"/>
<SelectedRowStyleBackColor="#FFCC66"Font-Bold="True"ForeColor="#663399"/>
<SortedAscendingCellStyleBackColor="#FEFCEB"/>
<SortedAscendingHeaderStyleBackColor="#AF0101"/>
<SortedDescendingCellStyleBackColor="#F6F0C0"/>
<SortedDescendingHeaderStyleBackColor="#7E0000"/>
</asp:GridView>
<br/>
</asp:Content>
Aspx code:
using System;
using System.Collections.Generic; using System.Linq;
using System.Web; using System.Web.UI;
using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Data;
publicpartialclassDisplayAllRecordOfBank : System.Web.UI.Page
{
SqlConnection con = newSqlConnection("Data Source=DHANANJAY-PC;Initial
Catalog=bankDB;User ID=sa;Password=123;Pooling=False");
SqlDataAdapter da;
SqlCommand cmd;
//string query;
<%@PageTitle=""Language="C#"MasterPageFile="~/MasterPage.master"AutoEventWireup
="true"CodeFil e="DisplayBranchDetails.aspx.cs"Inherits="DisplayBranchDetails"%>
<asp:ContentID="Content1"ContentPlaceHolderID="head"Runat="Server">
<h1>Display Branch Detail</h1>
<asp:LabelID="Label1"runat="server"Text="Select the BankName"></asp:Label>
:<asp:DropDownListID="DropDownList1"runat="server"AutoPostBack="True"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
</asp:DropDownList>
<br/>
<br/>
<asp:GridViewID="GridView1"runat="server">
</asp:GridView>
<br/>
</asp:Content>
Aspx code:
using System;
using System.Collections.Generic; using System.Linq;
using System.Web; using System.Web.UI;
try
{
con.Open();
Design Code to display the balance for the entered account number
<%@PageTitle=""Language="C#"MasterPageFile="~/MasterPage.master"AutoEventWireup
="true"CodeFil e="DisplayBalance.aspx.cs"Inherits="DisplayBalance"%>
<asp:ContentID="Content1"ContentPlaceHolderID="head"Runat="Server">
<tablestyle="width: 78%; height: 98px; vertical-align: middle; text-align: center;"
align="center">
<tr>
<tdstyle="width: 118px">
Account number </td>
<tdstyle="width: 155px">
<asp:TextBoxID="TextBox1"runat="server"Width="200px"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<tdstyle="width: 118px">
Bank ID</td>
<tdstyle="width: 155px">
<asp:DropDownListID="DropDownList1"runat="server"Width="200px">
</asp:DropDownList>
</td>
<td> </td>
</tr>
<tr>
<tdstyle="width: 118px">
Branch ID</td>
<tdstyle="width: 155px">
<asp:DropDownListID="DropDownList2"runat="server"Width="200px">
</asp:DropDownList>
</td>
<td> </td>
</tr>
<tr>
<tdstyle="width: 118px"> </td>
<tdstyle="width: 155px">
&nbs
p;
<asp:ButtonID="Button1"runat="server"Text="Display"Width="100px"
onclick="Button1_Click"/>
</td>
<td> </td>
</tr>
</table>
<asp:GridViewID="GridView1"runat="server">
</asp:GridView>
</asp:Content>
Aspx code:
using System;
using System.Collections.Generic; using System.Linq;
using System.Web; using System.Web.UI;
using System.Web.UI.WebControls; using System.Data.SqlClient; using System.Data;
publicpartialclassDisplayBalance : System.Web.UI.Page
{
SqlConnection con = newSqlConnection("Data Source=DHANANJAY-PC;Initial
Catalog=bankDB;User ID=sa;Password=123;Pooling=False");
SqlDataAdapter da;
SqlCommand cmd;
protectedvoid Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
con.Open();
string query = "select BankID from tbl_Bank "; cmd = newSqlCommand(query, con);
SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read())
{
DropDownList1.Items.Add(dr[0].ToString());
}
con.Close();
}
if (!IsPostBack)
{
con.Open();
string query = "select BranchID from tbl_Branch ";
}
protectedvoid Button1_Click(object sender, EventArgs e)
{
con.Open();
string query = "select *from tbl_Account where BranchID=" + DropDownList2.SelectedValue
+ "and BankID=" + DropDownList1.SelectedItem + " and AccountNo=" +TextBox1.Text+"";
con.Close();
}
}
Output:-
Reports:
Display all records of particular bank
Aim:
Algorithm:
FORM DESIGN:
WEB SERVICE :-
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
namespace Simpleinterestservice1
{
/// <summary>
/// Summary description for Service1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following
line.
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public int Simpleinterest(int P,int n,int r)
{
return (P *n *r)/100;
}
}
}
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)
{
localhost.Service1 mys = new localhost.Service1();
int P = Convert .ToInt32 (TextBox1 .Text);
int n = Convert .ToInt32 (TextBox2 .Text);
int r = Convert .ToInt32 (TextBox3 .Text);
int interest= mys.Simpleinterest (P,n,r);
TextBox4 .Text = interest .ToString ();
}
}
OUTPUT:
Result: