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.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.