Hello All,
I am having an update statament in my jsp. The problem is that when I am changing the whole fields in the jsp and executed the update statament, the DB will be updated, but when I am updating a certain field, the other fields will be "" in the SQL statement. Also, I am having a problem is that I am having a miss match in the date, so what is the best format to be applied in the SQL statement in my jsp.
FOr the first problem: HTML Code:
<select size="1" name="Nationality" class="content">
<option selected value="<%=Nationality%>"><%=Nationality%></option>
<%
try
{
ResultSet rs=null;
Statement st1=null;
String query = "select country_code, nationality_name from nationality_lkup ";
st1 = conn1.createStatement();
rs = st1.executeQuery(query);
while(rs.next())
{
%>
<option value="<%=rs.getString("country_code")%>" >
<%=rs.getString("nationality_name")%></option>
<%
}
}
catch (Exception e) {
e.printStackTrace();
}
%>
</select>
and the update statament is:
String sz_SQLUpdate = "UPDATE cir SET";
z_SQLUpdate = sz_SQLUpdate + " , nationality ='"+Nationality+"'";
Also, how can I deal with the date format in the update statement?