i have given an example for this below check that,
following is Programmer table:
PID-----PName-----DOB-------------DOJ-----------Gender--Prof1---Prof2
1-------ANAND-----1965-04-12------1992-04-21----M-------PASCAL--BASIC
3-------ALTAF-----1964-07-02------1990-11-13----M-------CLIPPER-COBOL
4-------JULIANA---1969-01-31------1990-04-21----F-------COBOL---DBASE
5-------KAMALA----1977-10-30------1992-01-02----F-------C-------DBASE
6-------MARY------1968-06-24------1991-02-01----F-------CPP-----ORACLE
7-------NELSON----1965-09-11------1989-10-11----M-------COBOL---DBASE
8-------RAMESH----1963-05-03------1991-02-28----M-------PASCAL--DBASE
below is software table:
PID---Title------------DevelopingLanguage----SCost---DCost---Sold
6-----README-----------CPP-------------------300-----1200----84
1-----PARACHUTES-------BASIC-----------------399.95--6000----43
1-----VIDEO TITLING----PASCAL----------------7500----16000---9
4-----INVENTORY--------COBOL-----------------3000----3500----0
5-----PAYROLL PKG.-----DBASE-----------------9000----20000---7
6-----FINANCIAL ACCT.--ORACLE----------------18000---85000---4
6-----CODE GENERATOR---C---------------------4500----20000---23
9-----VACCINES---------C---------------------1900----3100----21
8-----HOTEL MGMT.------DBASE-----------------13000---35000---4
8-----DEAD LEE---------PASCAL----------------599.95--4500----73
2-----PC UTILITIES-----C---------------------725-----5000----51
2-----TSR HELP PKG.----ASSEMBLY--------------2500----6000----7
3-----HOSPITAL MGMT.---PASCAL----------------1100----75000---2
4-----TSR EDITOR-------C---------------------900-----700-----6
now i need to display the Details of software Developed by Ramesh.
for that i need to join programmer and software tables and display the details.
here is the query for this:
Select Title, DevelopingLanguage, SCOST, DCOST, SOLD from Software INNER JOIN Programmer
ON Software.PID=Programmer.PId where Programmer.PName = 'RAMESH'
Title-----------DevelopingLanguage------SCOST----DCOST----SOLD
HOTEL MGMT.-----DBASE-------------------13000----35000----4
DEAD LEE--------PASCAL------------------599.95---4500-----3
string qry="Select Title, DevelopingLanguage, SCOST, DCOST, SOLD from Software INNER JOIN Programmer
ON Software.PID=Programmer.PId where Programmer.PName = 'RAMESH'";
DataSet ds;
SqldataAdapter adpt = new SqlDataAdapter(qry,cn);
ds = new DataSet();
adpt.fill(ds);
GridView1.DataSourec=ds.Tables[0];
GridView1.DataBind();