0

Hi,
I am fetching from a table and updating it back. I am fetching and populating the form. User will modify the form and then update the table. Everything looks fine but update and delete query is returning '0'
Here is a code snippet:

qid = (Integer.valueOf(iterator.next().toString()));
	answer = iterator.next();
	if (!(answer.equals("")))
	{
	System.out.println("m in db  "+qid);
	System.out.println("m in db  "+answer);
	ps = connection.prepareStatement("update portal_mangr set ans = ? where qid=? and empid=?");
	ps.setString(1,answer);
	ps.setInt(2, qid);
	ps.setString(3,username);   //this is passed into the method
	c = ps.executeUpdate();
	//c = statement.executeUpdate("update portal_manager set ans = '"+answer+"' where qid=qid and empid='"+username+"'");
	System.out.println("update done "+c);
	}

Its showing correct qid and updated answer but returning 0.

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by gyannitin
0

Hi all,
Please ignore this issue. I was passing wrong parameter into the method. My bad. :(

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.