
/* * Studentinfo2App.java */
package studentinfo2;
import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; import org.jdesktop.application.Application; import org.jdesktop.application.SingleFrameApplication; /** * The main class of the application. */ public class Studentinfo2App extends SingleFrameApplication {
/**
* At startup create and show the main frame of the application.
*/
@Override protected void startup() {
show(new Studentinfo2View(this));
ConnectDB();
}
/**
* This method is to initialize the specified window by injecting resources.
* Windows shown in our application come fully initialized from the GUI
* builder, so this additional configuration is not needed.
*/
@Override protected void configureWindow(java.awt.Window root) {
}
/**
* A convenient static getter for the application instance.
* @return the instance of Studentinfo2App
*/
public static Studentinfo2App getApplication() {
return Application.getInstance(Studentinfo2App.class);
}
/**
* Main method launching the application.
*/
public static void main(String[] args) {
launch(Studentinfo2App.class, args);
}
Statement Query;
Connection Connector;
private void ConnectDB() {
String driver = "sun.jdbc.odbc.jdbcodbcDriver";
String url = "StudentInfo2App.mdb";
try
{
Class.forName(driver);
Connector = DriverManager.getConnection(url);
Query = Connector.createStatement();
}
catch (Exception ex)
{
}
}
private void Addstudent()
{
try
{
Query.execute("Insert Student;");
}
catch (Exception ex)
{
}
}
private int RegisteredStudents(int Id)
{
try
{
ResultSet results = Query.executeQuery("Select Count(*) from Student Programme = "+ Id + ";");
return results.getInt(1);
}
catch (Exception ex)
{
}
return 0;
}
private void DeleteSTUD(int Id)
{
try
{
Query.execute("Delete Student = " + Id + ";");
}
catch (Exception ex)
{
}
}
private int TotalFemales()
{
try
{
ResultSet results = Query.executeQuery("Select the Count(*) from Student Gender = false;");
return results.getInt(1);
}
catch (Exception ex)
{
}
return 0;
}
private int Totalmales()
{
try
{
ResultSet results = Query.executeQuery("Select the Count(*) from Student Gender = true;");
return results.getInt(1);
}
catch (Exception ex)
{
}
return 0;
}
} could you plz check what is wrong wit my code because in my database user input from my applet does not show...