doubt regarding java Query
Pavithra Parthiban <[email protected]> Tue, 6 Mar 2007 10:10:36 +0530
| Newsgroups | gmane.comp.db.mysql.java |
|---|---|
| Organization | Photoninfotech Pvt.Ltd. |
| Message-ID | <000001c7621a$f3a27310$1f0210ac@PAVITHRAP> |
public void dbedit(String email1){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url="jdbc:odbc:db4";
Connection con=DriverManager.getConnection(url);
Statement st=con.createStatement();
String sql="update addr4 set addr4.id="null" where addr4.email='"+email1+"'";
st.execute(sql);
String sql1="update addr4 set addr4.firstname="null" where addr4.email='"+email1+"'";
st.execute(sql1);
String sql2="update addr4 set addr4.lastname="null" where addr4.email='"+email1+"'";
st.execute(sql2);
String sql3="update addr4 set addr4.age='null' where addr4.email='"+email1+"'";
st.execute(sql3);
String sql4="update addr4 set addr4.phone='null' where addr4.email='"+email1+"'";
st.execute(sql4);
String sql5="update addr4 set addr4.address='null' where addr4.email='"+email1+"'";
st.execute(sql5);
in ms access i have set id and age as number and all other fields are text .emailid is the primary key.in the update operation first i want to update all the values for the particular email id to be null .the particular email value should be there in the db all other in the row are "null" and then i want to replace all the "null" values by inserting values. could you help me soon.