tutorial netbeans how to search a part data from mysql database (vol.14)

tutorial netbeans how to search a part data from mysql database (vol.14)




Hello guys !!
Hows it going ??

Welcome back to masunduh2,last post,I’ve shared tutorial about how to edit and update data from mysql database with netbeans java swing part 13.now i gonna show you the next awesome tutorials How to search a part data from mysql database with netbeans java(vol.14)

How do that??

Lets get started !

Drag and drop jtextfield component for search the data with java programs into mysql database.
And rename to “search_text”

Then, right click “search_text [ jtextfields ]”
Events > Key > keyReleased

in search_textActionPerformed block
Type or copy all syntax below :
 
try {
String sql = "select * from dataop where username=?";

pst=connect.prepareStatement(sql);
pst.setString(1, search_text.getText()); // jtextfields name

rst=pst.executeQuery();

if(rst.next())
{
    String show1 = rst.getString("id"); 
    // id > field name in mysql database
    id_text.setText(show1);// jtextfields name
    
    String show2 = rst.getString("username");
    // username > field name in mysql database
    
    user_text.setText(show2); // jtextfields name
    String show3 = rst.getString("password");
    // password > field name in mysql database
    
    pass_text.setText(show3); // jtextfields name
    String show4 = rst.getString("age");
    age_text.setText(show4); // jtextfields name
    String show5 = rst.getString("email");
    email_text.setText(show5); // jtextfields name
    
}
        }
catch (Exception e) 
{
JOptionPane.showMessageDialog(null, e);
        }

 

Now, if no error in your java swing project you can run that programs

Click Run > choose Clean and build project.
Then, click run again > and select Run File.
Like image below
Screenshot

screenshot-tutorial netbeans how to search a part data from mysql database (vol.14)

Watch video tutorial how to search the data  from mysql database with netbeans java swing
part 14.


Please write comment,share it, and subscribed !
Don’t forget join on my fanspage now,ok  guys !

See you the next awesome and simple tutorials. Bye !



tutorial netbeans how to search a part data from mysql database (vol.14)
Item Reviewed: tutorial netbeans how to search a part data from mysql database (vol.14) 9 out of 10 based on 10 ratings. 9 user reviews.

0 Response to "tutorial netbeans how to search a part data from mysql database (vol.14)"

Post a Comment

Ads Inside Post