File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
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: 726
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: 10916
    
  12

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


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Farakh khan
Ranch Hand

Joined: Mar 22, 2008
Posts: 726
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://aspose.com/file-tools
 
subject: Want to print not inserted records
 
Similar Threads
Display each results from database in their own row
jsp & database
Pagebreak in JSP Page
Record Locking in multi-user
Insert into MS Access with PreparedStatement