database - update query issue using jsp -


please resolve update query (using jsp)

//resultset resultset object & working //rsmd resultsetmetadata object & fetching data properly

    for(int i=1;resultset.next();i++)     {     update_query="update demo_table set ";      for(int j=1;j<=rsmd.getcolumncount();j++)     {         temp_str=request.getparameter(rsmd.getcolumnname(j)+i);     // having id of textboxes of columnname1,columnname2(eg. s_no1, name1) using          if(j==rsmd.getcolumncount())         {            update_query+=rsmd.getcolumnname(j)+"=\'"+temp_str+"\'" ;//not working //working  update_query+=rsmd.getcolumnname(j)+"=\""+ temp_str+"\""  ;         }          else         {            update_query+=rsmd.getcolumnname(j)+ "=\'"+ temp_str+"\' ,";//not working //working  update_query+=rsmd.getcolumnname(j)+ "=\"" + temp_str + "\" ,";         }     }  . . . . remaining update query statement clause...  please help...it's not working i.e. it's not inserting single quotes in update_query string 

it seems no problem syntax, should work.

example:

public static void main(string[] arg) {         string strcolname="empname";         string strval = "smith";         string update_query = "update employee set ";          update_query += strcolname + "=\'"+ strval +"\'";          system.out.println(update_query);     } 

output:

run:

update employee set empname='smith'

build successful (total time: 0 seconds)


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -