Jo Eagle

Greenhorn
+ Follow
since Feb 14, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Jo Eagle

Having trouble with the SQL code - not sure if this is right can anyone help me out.Do I have to make another class?
Code------
public void deleteRecord(){
guestLastName = txtLastName.getText();
guestFirstName = txtFirstName.getText();
guestEmail =txtEmail.getText();
guestStreetAddress =txtStreetAddress.getText();
guestCity =txtCity.getText();
guestState = txtState.getText();
guestZip =txtZip.getText();
guestHPhone = txtHPhone.getText();
guestWPhone = txtWPhone.getText();
guestCell = txtCell.getText();
guestFax = txtFax.getText();
guestEmployer = txtEmployer.getText();
guestMisc = txtMisc.getText();

try{ SQL = "Delete From AddressBook Where LastName = ('"+guestLastName+"','"+guestFirstName ','"+guestEmail+"','"+guestStreetAddress+"','"+ "','"+guestState+"','"+guestZip+"','"+guestHPhone+"','"+ guestWPhone+"','"+guestCell+"','"+guestFax+"','"+
guestEmployer+"','"+guestMisc+"');";
}catch(Exception e){
System.out.println("Fail to Load JDBC?ODBC driver.");
}}}
So then would the following be correct?
public abstract class Abstrat1{
public void AbstractMethod();
public void ConcreteMethod(){
String StrName = "Jo Eagle";
}
}
public class MyClass extends Abstrat1{
public void AbstractMethod(){
MyClass mc = new MyClass();
mc.abstractmethod();
}
public String ConcreteMethod(){
String StrName = "Jo Eagle";
return StrName;
}

23 years ago
Thank guys - I'll give your suggestions a try - starting first with sql tutorial. I'm sure I'll be back with more questions - but thank you for your time and help. Jo
Is this correct - make a separate class?
import java.sql.*;
public class InsertRows{
public static Connection con;
public static Statement stmt;
public static String SQL_STRING;
public static ResultSet my_rs;
public ResultSet InsertRows(){
try {
Class.forName("com.ms.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc dbc:AddressBook";
con = DriverManager.getConnection(url,"","");
stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
Resultset uprs = stmt.executeQuery("SELECT* FROM AddressBook";
uprs.moveToInsertRow();
uprs.updateString("LastName","");
uprs.updateString("FirstName","");
uprs.updateString("StreetAddress","");
uprs.updateString("City","");
uprs.updateString("State","");
uprs.updateString("Zip","");
uprs.insertRow();
uprs.beforeFirst();
while(uprs.next()){
String name = uprs.getString("LastName");
.....
}
uprs.close();
stmt.close();
con.close();
}catch(SQLException ex){
......
}
}

[This message has been edited by Jo Eagle (edited March 30, 2001).]
[This message has been edited by Jo Eagle (edited March 30, 2001).]
How do I use the Concrete class? String Dog = new String;?
23 years ago
Lets say I have the following code:
public abstract class Abstrat1{
public abstract void AbstractMethod();
public void ConcreteMethod(){
String strName = "Jo Eagle";
}
}
Question 1 - how do I provide a new class definition for a legal class that will inherit from this class? Using the methods - confused on this.
23 years ago
looking for an example of an abstract class with one abstract method and one concrete method - and a child class - how does one inherit from each?
[This message has been edited by Jo Eagle (edited March 30, 2001).]
23 years ago
the JDBC class that goes with the previous submitted question.
Books - online resources - any help welcome. JO
import java.sql.*;
public class JDBC {
public static Connection con;
public static Statement stmt;
public static String SQL_STRING;
public static ResultSet my_rs;
public ResultSet getData(){
try {
//step 1 --load the driver
Class.forName("com.ms.jdbc.odbc.JdbcOdbcDriver");
//step 2 --create a connection
String url = "jdbc dbc:AddressBook";
con = DriverManager.getConnection(url,"","");
//step 3 --
stmt = con.createStatement();
//execute statement and return results
SQL_STRING = "SELECT * FROM AddressBook";
my_rs = stmt.executeQuery(SQL_STRING);
return my_rs;
} catch(Exception e) {
return my_rs;
}
}
}
Could someone Please help me - I am able to read data from a MS Access database and display it in my GUI - w/first and next buttons - how do I add-- take input from a user and write this information back to the database? Then be able to look it up. (save it) I'm trying to make an address book.
Any help would be apprecatied.
Jo
----Code for getting data----
public void FillInDataFields(){
boolean bMoreData;
bMoreData = false;
try {
bMoreData = this.rs.next();
if (bMoreData == true){
txtLastName.setText(rs.getString("LastName"));
txtFirstName.setText(rs.getString("FirstName"));
txtEmail.setText(rs.getString("Email"));
txtStreetAddress.setText (rs.getString"StreetAddress"));
txtCity.setText(rs.getString("City"));
txtState.setText(rs.getString("State"));
txtZip.setText(rs.getString("Zip"));
txtHPhone.setText(rs.getString("HPhone"));
txtWPhone.setText(rs.getString("WPhone"));
txtCell.setText(rs.getString("Cell"));
txtFax.setText(rs.getString("Fax"));
txtEmployer.setText(rs.getString("Employer"));
txtMisc.setText(rs.getString("Misc"));
}
} catch(Exception e) {
}
-----------------------------
Thank you for your help - I'll give it a try.
-Jo
Sorry for posting this in the wrong section -
new to this great site and new to java - trying to teach myself.
Thank you for your help - I'll give it a try.
-Jo
Sorry for posting this in the wrong section -
new to this great site and new to java - trying to teach myself.
23 years ago
I'm trying to have the background color of the Applet change when there is a mouse click. (Randomly)
I've tried:
//-----
public void mouseClicked(MouseEvent e) {
mouseX = 0;
mouseY = 0;
msg ="Mouse Clicked." ;
setBackground(Color.green);
repaint();
}
//----
Do I use math.random ? Do I need to use RGB numbers?
Jo
23 years ago
I'm trying to have the background color of the Applet change when there is a mouse click. (Randomly)
I've tried:
//-----
public void mouseClicked(MouseEvent e) {
mouseX = 0;
mouseY = 0;
msg ="Mouse Clicked." ;
setBackground(Color.green);
repaint();
}
//----
Do I use math.random ? Do I need to use RGB numbers?
Jo