SlideShare a Scribd company logo
1 of 28
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt)
{
this.setVisible(false);
new DELREC().setVisible(true);
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
this.setVisible(false);
new ADDREC().setVisible(true);
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
{
this.setVisible(false);
new MODREC().setVisible(true);
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt)
{
this.setVisible(false);
new DISPALL().setVisible(true);
}
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt)
{
this.setVisible(false);
new DISPCLS().setVisible(true);
}
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt)
{
this.setVisible(false);
new DISPREPORT().setVisible(true);
}
try
{
Class.forName("com.mysql.jdbc.Driver");
Connectioncon= (Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/prashant","root","admin");
Statementsmt=(Statement)con.createStatement();
intrl =Integer.parseInt(rol.getText().trim());
Stringcname = na.getText().trim();
Stringcls = cl.getText().trim();
Stringstrm = st.getText().trim();
intpy = Integer.parseInt(ph.getText().trim());
intm=Integer.parseInt(ma.getText().trim());
intc=Integer.parseInt(ch.getText().trim());
intcmp=Integer.parseInt(co.getText().trim());
inte=Integer.parseInt(en.getText().trim());
inttotl=(py+m+c+cmp+e);
floatp=(float)(totl/5);
Stringgd;
if(p>=85)
gd="A";
else if(p>=75&& p<85)
gd="B";
else if(p>=65&& p<75)
gd="c";
else
gd="F";
StringstrSQL = "INSERT INTO
student(Roll_No,Name,Class,Stream,Physics,Maths,Chemistry,Computer,English,Total,Grade) VALUES
('"+(rl)+"','"+(cname)+"','"+(cls)+"','"+(strm)+"',"+(py)+","+(m)+","+(c)+","+(cmp)+","+(e)+","+(totl)+",'"+(gd)+"
')";
introwsEffected=smt.executeUpdate(strSQL);
JOptionPane.showMessageDialog(this,"Recordsuccessfullyinserted");
System.out.println(rowsEffected+" rowseffected");
smt.close();
con.close();
}
catch (Exceptione) {
JOptionPane.showMessageDialog(this,e.getMessage());
}
}
CODING
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/prashant","root","a
dmin");
Statement smt= (Statement) con.createStatement();
ResultSet rs=null;
String sna=jTextField1.getText().trim();
int no=Integer.parseInt(jTextField2.getText().trim());
String na=jTextField5.getText().trim();
String cl=jTextField3.getText().trim();
String st=jTextField4.getText().trim();
int py=Integer.parseInt(jTextField6.getText().trim());
int m=Integer.parseInt(jTextField7.getText().trim());
int c=Integer.parseInt(jTextField8.getText().trim());
int co=Integer.parseInt(jTextField9.getText().trim());
int en=Integer.parseInt(jTextField10.getText().trim());
jTextField11.setText(" ");
jTextField12.setText(" ");
int t=(py+m+c+co+en);
jTextField11.setText(" "+t);
int tt=Integer.parseInt(jTextField11.getText().trim());
float p=(float)(tt/5);
String gd;
if(p>=85)
gd="A";
else if(p>=75 && p<85)
gd="B";
else if(p>=65 && p<75)
gd="c";
else
gd="F";
jTextField12.setText(""+gd);
String gd1=jTextField12.getText().trim();
String qry="Updatestudentset
roll_no="+(no)+",name='"+(na)+"',class='"+(cl)+"',stream='"+(st)+"',physics="+(p
y)+",maths="+(m)+",chemistry="+(c)+",computer="+(co)+",english="+(en)+",tota
l="+(tt)+",grade='"+(gd1)+"' wherename='"+(sna)+"'";
int r=smt.executeUpdate(qry);
if(r==0)
JOptionPane.showMessageDialog(this,"record doesnotexixts");
else
JOptionPane.showMessageDialog(this,"record Upated");
con.close();
}
catch (Exception e)
{
JOptionPane.showMessageDialog(this,e.getMessage());
e.printStackTrace(); }
String cl = jTextField1.getText().trim();
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
int rows = model.getRowCount();
if (rows > 0) {
for (int i = 0; i < rows; i++) {
model.removeRow(0);
}
}
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/prashant", "root", "admin");
Statement stmt = (Statement) con.createStatement();
String query = "SELECT * FROM Student where NAME='" + cl + "'";
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
int rl = rs.getInt("roll_no");
String cName = rs.getString("name");
String cls = rs.getString("class");
String st = rs.getString("stream");
int py = rs.getInt("physics");
int m = rs.getInt("maths");
int c = rs.getInt("chemistry");
int co = rs.getInt("computer");
int en = rs.getInt("english");
int tt = rs.getInt("total");
String gd = rs.getString("grade");
System.out.println(rl + "|" + cName + "|" + cl);
model.addRow(new Object[]{rl, cName, cls, st, tt, gd});
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
}
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
String cl = jTextField1.getText().trim();
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/ashok", "root", "akt");
Statement stmt = (Statement) con.createStatement();
String query = "DELETE FROM Student where NAME='" + cl + "'";
int r = stmt.executeUpdate(query);
if (r == 0) {
JOptionPane.showMessageDialog(this, "RECORD does not Exixts");
} else {
JOptionPane.showMessageDialog(this, "RECORD is Deleted Plz check the List");
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
}
}
String query = "SELECT * FROM Student";
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/prashant","root","admin");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
int rl = rs.getInt("roll_no");
String cName = rs.getString("name");
String cl = rs.getString("class");
String st = rs.getString("stream");
int py = rs.getInt("physics");
int m = rs.getInt("maths");
int c = rs.getInt("chemistry");
int co = rs.getInt("computer");
int en = rs.getInt("english");
System.out.println(rl + "|" + cName + "|" + cl);
model.addRow(new Object[] {rl, cName, cl, st,py,m,c,co,en});
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
}
}
String cl=jTextField1.getText().trim();
DefaultTableModel model = (DefaultTableModel) jTable1.getModel();
int rows = model.getRowCount();
if (rows > 0) {
for (int i = 0; i < rows; i++) {
model.removeRow(0);
}
}
String query = "SELECT * FROM Student where class='"+cl+"'";
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/prashant","root","admin");
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
int rl = rs.getInt("roll_no");
String cName = rs.getString("name");
String cls = rs.getString("class");
String st = rs.getString("stream");
int py = rs.getInt("physics");
int m = rs.getInt("maths");
int c = rs.getInt("chemistry");
int co = rs.getInt("computer");
int en = rs.getInt("english");
System.out.println(rl + "|" + cName + "|" + cl);
model.addRow(new Object[] {rl, cName, cls, st,py,m,c,co,en});
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
}
}
String sna=jTextField1.getText().trim();
String query = "SELECT * FROM Student where name='"+sna+"'";
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/prashant","root","admin");
Statement stmt = (Statement) con.createStatement();
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
jTextField2.setText(""+rs.getInt("roll_no"));
jTextField3.setText(""+rs.getString("name"));
jTextField4.setText(""+rs.getString("class"));
jTextField5.setText(""+rs.getString("stream"));
jTextField6.setText(""+rs.getInt("physics"));
jTextField7.setText(""+rs.getInt("maths"));
jTextField8.setText(""+rs.getInt("chemistry"));
jTextField9.setText(""+rs.getInt("computer"));
jTextField10.setText(""+rs.getInt("english"));
jTextField11.setText(""+rs.getInt("total"));
jTextField12.setText(""+rs.getString("grade"));
float
p=(float)(rs.getInt("physics")+rs.getInt("maths")+rs.getInt("chemistry")+rs.getInt("computer")+rs.ge
tInt("english"))/5;
jTextField13.setText(""+p);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
}
}

More Related Content

What's hot

Js 单元测试框架介绍
Js 单元测试框架介绍Js 单元测试框架介绍
Js 单元测试框架介绍
louieuser
 
Refactoring Jdbc Programming
Refactoring Jdbc ProgrammingRefactoring Jdbc Programming
Refactoring Jdbc Programming
chanwook Park
 
Resultados
ResultadosResultados
Resultados
jbersosa
 
This is a basic JAVA pgm that contains all of the major compoents of DB2
This is a basic JAVA pgm that contains all of the major compoents of DB2This is a basic JAVA pgm that contains all of the major compoents of DB2
This is a basic JAVA pgm that contains all of the major compoents of DB2
Sheila A. Bell, MS, PMP
 

What's hot (20)

Js 单元测试框架介绍
Js 单元测试框架介绍Js 单元测试框架介绍
Js 单元测试框架介绍
 
Notepad
NotepadNotepad
Notepad
 
Migrating from Flux to Redux. Why and how.
Migrating from Flux to Redux. Why and how.Migrating from Flux to Redux. Why and how.
Migrating from Flux to Redux. Why and how.
 
Ensure code quality with vs2012
Ensure code quality with vs2012Ensure code quality with vs2012
Ensure code quality with vs2012
 
2019-10-05 - Untangled - Voxxed days ticino
2019-10-05 - Untangled - Voxxed days ticino2019-10-05 - Untangled - Voxxed days ticino
2019-10-05 - Untangled - Voxxed days ticino
 
Introduction to Unit Testing (Part 2 of 2)
Introduction to Unit Testing (Part 2 of 2)Introduction to Unit Testing (Part 2 of 2)
Introduction to Unit Testing (Part 2 of 2)
 
MaintainStaffTable
MaintainStaffTableMaintainStaffTable
MaintainStaffTable
 
Refactoring Jdbc Programming
Refactoring Jdbc ProgrammingRefactoring Jdbc Programming
Refactoring Jdbc Programming
 
Introduccion a Jasmin
Introduccion a JasminIntroduccion a Jasmin
Introduccion a Jasmin
 
Resultados
ResultadosResultados
Resultados
 
The Ring programming language version 1.5.3 book - Part 88 of 184
The Ring programming language version 1.5.3 book - Part 88 of 184The Ring programming language version 1.5.3 book - Part 88 of 184
The Ring programming language version 1.5.3 book - Part 88 of 184
 
Dat testing - An introduction to Java and Android Testing
Dat testing - An introduction to Java and Android TestingDat testing - An introduction to Java and Android Testing
Dat testing - An introduction to Java and Android Testing
 
This is a basic JAVA pgm that contains all of the major compoents of DB2
This is a basic JAVA pgm that contains all of the major compoents of DB2This is a basic JAVA pgm that contains all of the major compoents of DB2
This is a basic JAVA pgm that contains all of the major compoents of DB2
 
The Ring programming language version 1.9 book - Part 91 of 210
The Ring programming language version 1.9 book - Part 91 of 210The Ring programming language version 1.9 book - Part 91 of 210
The Ring programming language version 1.9 book - Part 91 of 210
 
Calculon
CalculonCalculon
Calculon
 
The Ring programming language version 1.5.1 book - Part 75 of 180
The Ring programming language version 1.5.1 book - Part 75 of 180The Ring programming language version 1.5.1 book - Part 75 of 180
The Ring programming language version 1.5.1 book - Part 75 of 180
 
No SQL Unit - Devoxx 2012
No SQL Unit - Devoxx 2012No SQL Unit - Devoxx 2012
No SQL Unit - Devoxx 2012
 
async/await Revisited
async/await Revisitedasync/await Revisited
async/await Revisited
 
Railway reservation system
Railway reservation systemRailway reservation system
Railway reservation system
 
New text document
New text documentNew text document
New text document
 

Similar to Student management system

srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docxsrcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
whitneyleman54422
 
20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx
20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx
20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx
AliHaiderCheema2
 
Exercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera CymbronExercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera Cymbron
cymbron
 
How do I make my JTable non editableimport java.awt.; import j.pdf
How do I make my JTable non editableimport java.awt.; import j.pdfHow do I make my JTable non editableimport java.awt.; import j.pdf
How do I make my JTable non editableimport java.awt.; import j.pdf
forwardcom41
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests
Tomek Kaczanowski
 
In Java Write a GUI application to simulate writing out a check. The.pdf
In Java Write a GUI application to simulate writing out a check. The.pdfIn Java Write a GUI application to simulate writing out a check. The.pdf
In Java Write a GUI application to simulate writing out a check. The.pdf
flashfashioncasualwe
 

Similar to Student management system (20)

srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docxsrcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
srcArtifact.javasrcArtifact.javaclassArtifactextendsCave{pub.docx
 
Wwe Management System
Wwe Management SystemWwe Management System
Wwe Management System
 
20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx
20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx
20-Arid-850 Ali Haider Cheema BSSE(5A) Evening MPL Assignement 08.docx
 
Jason parsing
Jason parsingJason parsing
Jason parsing
 
Higher-Order Components — Ilya Gelman
Higher-Order Components — Ilya GelmanHigher-Order Components — Ilya Gelman
Higher-Order Components — Ilya Gelman
 
2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests
 
04 Advanced Javascript
04 Advanced Javascript04 Advanced Javascript
04 Advanced Javascript
 
JavaScript patterns
JavaScript patternsJavaScript patterns
JavaScript patterns
 
Exercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera CymbronExercícios Netbeans - Vera Cymbron
Exercícios Netbeans - Vera Cymbron
 
Ejemplo radio
Ejemplo radioEjemplo radio
Ejemplo radio
 
Workshop 5: JavaScript testing
Workshop 5: JavaScript testingWorkshop 5: JavaScript testing
Workshop 5: JavaScript testing
 
The next step, part 2
The next step, part 2The next step, part 2
The next step, part 2
 
Understanding JavaScript Testing
Understanding JavaScript TestingUnderstanding JavaScript Testing
Understanding JavaScript Testing
 
How do I make my JTable non editableimport java.awt.; import j.pdf
How do I make my JTable non editableimport java.awt.; import j.pdfHow do I make my JTable non editableimport java.awt.; import j.pdf
How do I make my JTable non editableimport java.awt.; import j.pdf
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeleton
 
culadora cientifica en java
culadora cientifica en javaculadora cientifica en java
culadora cientifica en java
 
33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests33rd Degree 2013, Bad Tests, Good Tests
33rd Degree 2013, Bad Tests, Good Tests
 
In Java Write a GUI application to simulate writing out a check. The.pdf
In Java Write a GUI application to simulate writing out a check. The.pdfIn Java Write a GUI application to simulate writing out a check. The.pdf
In Java Write a GUI application to simulate writing out a check. The.pdf
 
Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0Component lifecycle hooks in Angular 2.0
Component lifecycle hooks in Angular 2.0
 
Ian 20150116 java script oop
Ian 20150116 java script oopIan 20150116 java script oop
Ian 20150116 java script oop
 

Recently uploaded

Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 

Recently uploaded (20)

Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of TransformationWSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
WSO2CON 2024 - Designing Event-Driven Enterprises: Stories of Transformation
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
WSO2CON 2024 - Not Just Microservices: Rightsize Your Services!
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
 
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
 
WSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital BusinessesWSO2CON 2024 - Software Engineering for Digital Businesses
WSO2CON 2024 - Software Engineering for Digital Businesses
 
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
WSO2Con2024 - GitOps in Action: Navigating Application Deployment in the Plat...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public AdministrationWSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
WSO2CON 2024 - How CSI Piemonte Is Apifying the Public Administration
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 

Student management system

  • 1.
  • 2. private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { this.setVisible(false); new DELREC().setVisible(true); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { this.setVisible(false); new ADDREC().setVisible(true); } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { this.setVisible(false); new MODREC().setVisible(true); } private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) { this.setVisible(false); new DISPALL().setVisible(true); } private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
  • 3. this.setVisible(false); new DISPCLS().setVisible(true); } private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) { this.setVisible(false); new DISPREPORT().setVisible(true); }
  • 4.
  • 5.
  • 6.
  • 7. try { Class.forName("com.mysql.jdbc.Driver"); Connectioncon= (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/prashant","root","admin"); Statementsmt=(Statement)con.createStatement(); intrl =Integer.parseInt(rol.getText().trim()); Stringcname = na.getText().trim(); Stringcls = cl.getText().trim(); Stringstrm = st.getText().trim(); intpy = Integer.parseInt(ph.getText().trim()); intm=Integer.parseInt(ma.getText().trim()); intc=Integer.parseInt(ch.getText().trim()); intcmp=Integer.parseInt(co.getText().trim()); inte=Integer.parseInt(en.getText().trim()); inttotl=(py+m+c+cmp+e); floatp=(float)(totl/5); Stringgd;
  • 8. if(p>=85) gd="A"; else if(p>=75&& p<85) gd="B"; else if(p>=65&& p<75) gd="c"; else gd="F"; StringstrSQL = "INSERT INTO student(Roll_No,Name,Class,Stream,Physics,Maths,Chemistry,Computer,English,Total,Grade) VALUES ('"+(rl)+"','"+(cname)+"','"+(cls)+"','"+(strm)+"',"+(py)+","+(m)+","+(c)+","+(cmp)+","+(e)+","+(totl)+",'"+(gd)+" ')"; introwsEffected=smt.executeUpdate(strSQL); JOptionPane.showMessageDialog(this,"Recordsuccessfullyinserted"); System.out.println(rowsEffected+" rowseffected"); smt.close(); con.close(); } catch (Exceptione) { JOptionPane.showMessageDialog(this,e.getMessage()); } }
  • 9.
  • 10.
  • 12. try { Class.forName("com.mysql.jdbc.Driver"); Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/prashant","root","a dmin"); Statement smt= (Statement) con.createStatement(); ResultSet rs=null; String sna=jTextField1.getText().trim(); int no=Integer.parseInt(jTextField2.getText().trim()); String na=jTextField5.getText().trim(); String cl=jTextField3.getText().trim(); String st=jTextField4.getText().trim(); int py=Integer.parseInt(jTextField6.getText().trim()); int m=Integer.parseInt(jTextField7.getText().trim()); int c=Integer.parseInt(jTextField8.getText().trim()); int co=Integer.parseInt(jTextField9.getText().trim()); int en=Integer.parseInt(jTextField10.getText().trim()); jTextField11.setText(" "); jTextField12.setText(" "); int t=(py+m+c+co+en); jTextField11.setText(" "+t); int tt=Integer.parseInt(jTextField11.getText().trim()); float p=(float)(tt/5); String gd;
  • 13. if(p>=85) gd="A"; else if(p>=75 && p<85) gd="B"; else if(p>=65 && p<75) gd="c"; else gd="F"; jTextField12.setText(""+gd); String gd1=jTextField12.getText().trim(); String qry="Updatestudentset roll_no="+(no)+",name='"+(na)+"',class='"+(cl)+"',stream='"+(st)+"',physics="+(p y)+",maths="+(m)+",chemistry="+(c)+",computer="+(co)+",english="+(en)+",tota l="+(tt)+",grade='"+(gd1)+"' wherename='"+(sna)+"'"; int r=smt.executeUpdate(qry); if(r==0) JOptionPane.showMessageDialog(this,"record doesnotexixts"); else JOptionPane.showMessageDialog(this,"record Upated"); con.close(); } catch (Exception e) { JOptionPane.showMessageDialog(this,e.getMessage()); e.printStackTrace(); }
  • 14.
  • 15.
  • 16. String cl = jTextField1.getText().trim(); DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); int rows = model.getRowCount(); if (rows > 0) { for (int i = 0; i < rows; i++) { model.removeRow(0);
  • 17. } } try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/prashant", "root", "admin"); Statement stmt = (Statement) con.createStatement(); String query = "SELECT * FROM Student where NAME='" + cl + "'"; ResultSet rs = stmt.executeQuery(query); while (rs.next()) { int rl = rs.getInt("roll_no"); String cName = rs.getString("name"); String cls = rs.getString("class"); String st = rs.getString("stream"); int py = rs.getInt("physics"); int m = rs.getInt("maths"); int c = rs.getInt("chemistry"); int co = rs.getInt("computer"); int en = rs.getInt("english"); int tt = rs.getInt("total"); String gd = rs.getString("grade"); System.out.println(rl + "|" + cName + "|" + cl); model.addRow(new Object[]{rl, cName, cls, st, tt, gd}); } } catch (Exception e) {
  • 18. JOptionPane.showMessageDialog(this, e.getMessage()); } } private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { String cl = jTextField1.getText().trim(); try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/ashok", "root", "akt"); Statement stmt = (Statement) con.createStatement(); String query = "DELETE FROM Student where NAME='" + cl + "'"; int r = stmt.executeUpdate(query); if (r == 0) { JOptionPane.showMessageDialog(this, "RECORD does not Exixts"); } else { JOptionPane.showMessageDialog(this, "RECORD is Deleted Plz check the List"); } } catch (Exception e) { JOptionPane.showMessageDialog(this, e.getMessage()); } }
  • 19.
  • 20. String query = "SELECT * FROM Student"; try {
  • 21. Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/prashant","root","admin"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(query); while (rs.next()) { int rl = rs.getInt("roll_no"); String cName = rs.getString("name"); String cl = rs.getString("class"); String st = rs.getString("stream"); int py = rs.getInt("physics"); int m = rs.getInt("maths"); int c = rs.getInt("chemistry"); int co = rs.getInt("computer"); int en = rs.getInt("english"); System.out.println(rl + "|" + cName + "|" + cl); model.addRow(new Object[] {rl, cName, cl, st,py,m,c,co,en}); } } catch (Exception e) { JOptionPane.showMessageDialog(this, e.getMessage()); } }
  • 22.
  • 24. DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); int rows = model.getRowCount(); if (rows > 0) { for (int i = 0; i < rows; i++) { model.removeRow(0); } } String query = "SELECT * FROM Student where class='"+cl+"'"; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/prashant","root","admin"); Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(query); while (rs.next()) { int rl = rs.getInt("roll_no"); String cName = rs.getString("name"); String cls = rs.getString("class"); String st = rs.getString("stream"); int py = rs.getInt("physics"); int m = rs.getInt("maths"); int c = rs.getInt("chemistry"); int co = rs.getInt("computer"); int en = rs.getInt("english");
  • 25. System.out.println(rl + "|" + cName + "|" + cl); model.addRow(new Object[] {rl, cName, cls, st,py,m,c,co,en}); } } catch (Exception e) { JOptionPane.showMessageDialog(this, e.getMessage()); } }
  • 26.
  • 27. String sna=jTextField1.getText().trim(); String query = "SELECT * FROM Student where name='"+sna+"'"; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/prashant","root","admin"); Statement stmt = (Statement) con.createStatement(); ResultSet rs = stmt.executeQuery(query); while (rs.next()) { jTextField2.setText(""+rs.getInt("roll_no")); jTextField3.setText(""+rs.getString("name")); jTextField4.setText(""+rs.getString("class")); jTextField5.setText(""+rs.getString("stream"));