aspose file tools
The moose likes Beginning Java and the fly likes Want to print not inserted records Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Want to print not inserted records" Watch "Want to print not inserted records" New topic
Author

Want to print not inserted records

Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 672
I am trying to check in the database that if the record exists then don't insert. The following code is working well but I want to print that what records not inserted.

Thanks & best regards

if(category.equals("1")){
String query="select aa from aa where aa=?";
String query1="insert into aa(aa) values(?)";

PreparedStatement ps=cnn.prepareStatement(query);

for(i=0;i<listVal.length;i++){
ps.setString(1, listVal[i]);
rs=ps.executeQuery();
if(rs.next()){
String exists=rs.getString(1);
if(listVal[i].equals(exists)){
//ExiststedRecords=???Her I want to print that these records exists

}
}else{
update
out.println("("+count+") Record Inserted Successfull<br>"+
"The following Records already exists in database<br>"+ExistedRecords);
}

}
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 9955
    
    6

What's wrong with simply using a "System.out.println("the record exists");", or some such?


Never ascribe to malice that which can be adequately explained by stupidity.
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 672
Originally posted by fred rosenberger:
What's wrong with simply using a "System.out.println("the record exists");", or some such?


Thanks a lot!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Want to print not inserted records
 
Similar Threads
Display each results from database in their own row
jsp & database
Insert into MS Access with PreparedStatement
Pagebreak in JSP Page
Record Locking in multi-user