NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

how to search jtable in netbeans?

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
saurabhsaagu



Joined: 23 Oct 2009
Posts: 1

PostPosted: Fri Oct 23, 2009 4:10 pm    Post subject: how to search jtable in netbeans? Reply with quote

hi everyone!

i'm new to netbeans,and trying to create a simple desktop application with database connectivity. i'm using MySql as the backend,and have achieved basic connectivity,i i.e. connecting to the table and displaying records. Now i want to implement operations like searching,etc using preparedstatement. i know how to write the sql query,but i wanna know how to bring the results to a jtable. in past i've used a textarea for the same purpose,using code like given below:

PreparedStatement prep=cn.prepareStatement("select * from Details where Price =?");
prep.setFloat(1,Float.parseFloat(t1.getText()));
ResultSet r=prep.executeQuery();
while(r.next())
{
String val=r.getString(1)+"\t"+r.getString(2)+"\t"+r.getString(3)+"\t"+r.getString(4)+"\t"+r.getString(5)+"\t"+r.getFloat(6)+"\n";
PriceSearchResults.sta.append(val);
}

can anyone plz guide me how to achieve the same effect in netbeans?
also, plz tell if there is any sql editor kind of thing in which i can create such search queries and bind them to jtables using drag-and-drop?
any hints or links wud be helpful!!

regards.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo