Please I really would appreciate any hints on what I am doing wrong. I want to insert data into a mysql database through a swing GUI, but each time I end up inserting
string objects instead of the actual data. I really frustrated at this point. My code snippets are below:
if( isNameCorrect( nameInput) & isAgeCorrect(ageInput) & isStateCorrect(stateInput) & isLocationCorrect(locationInput)& isDateCorrect(dateInput) ){
InsertData(nameField.getText(), ageField.getText(), stateField.getText(), locationField.getText(), dateField.getText());
== =======================================================================
The Insert Method:
=========================================================================
public void InsertData(String nameInput, String ageInput, String stateInput, String locationInput, String dateInput){
Connection ThisSqlConnection = mysqlConnection();
try {
Statement statement = ThisSqlConnection.createStatement();
String sqlStatement = ("insert Into
Test Values('nameInput', "+" 'ageInput', "+" 'stateInput',"+" 'locationInput',"+" 'dateInput')");
statement.executeUpdate(sqlStatement);
} catch (SQLException ex) {
System.out.println("Exception:" + ex.getMessage());
}
}