Комментарии:
How search data record in text field from directly below make a jtable1with already take data from database am dawood pls sir make tutrl
Ответитьwhat if user have many entry with same name?
Ответитьst=con.prepareStatement("SELECT * FROM EmployeeInfo where Name=? or EmployeeID=? or Surname=? ");
st.setString(1, search.getText());
st.setString(2, search.getText());
st.setString(3, search.getText());
rs= st.executeQuery();
this ie enough
how to add autocomplete while searching.
Ответитьhow to show the search result in Table
Ответитьhow to show the search result in Table
Ответитьwhat is pst? i seem to have problem with it. it doesnt recognize when i type it and gives error
ОтветитьBad practice, why cloning code, what about 'OR' using in the query?
Ответитьjust you can do this :
try {
String tmp = search.getText();
String sql = "select * from Employeeinfo where name=? or employeeid=?" ;
pst = con.prepareStatement(sql);
pst.setString(1, tmp);
pst.setString(2, tmp);
rs = pst.executeQuery();
.
..
.
.
.
}
How to put the searched data to jtable? Help please
Ответитьthanks :)
ОтветитьHi, I am very happy to see you about java tutorial video, I want to ask is how to find data on Form1 when in enter will appear form2 to find the data and returns the search results to Form1 back, thank you for, quest, and if it could vedio toturialnya
ОтветитьU dont need to copy paste the code code use following query "SELECT * FROM Employeeinfo WHERE employeeid = ' "+txt_search.getText()+" ' OR name = ' "+txt_search.getText()+" ' OR surname = ' "+txt_search.getText()+" ' OR age = ' "+txt_search.getText()+" ' OR age = ' "+txt_search.getText()+" ' ";
ОтветитьHello .. im new in java. can you please make this program using gui? i cant understand this prog. coz its netbeans i dont know how to use netbeans. i want this prog in gui. please .. help me
Ответитьwhat is the source code of this program??
Ответитьwhat is pst
Ответить& what if we have 2 or more similar data ?
ОтветитьIs there any search using keyword??? Like I type in "pa" instand of "paul" and every record start with "pa" will list in JTabel and let user to select which record they want
Ответитьi think its better to use combobox for specific search then a search button. Like this put this to search button or the releasekey in the video if(combo.getSelectedItem().equals("ID")){ String sql="Select * FROM tbl_students where ID=?"; - - - - } else if(combo.getSelectedItem().equals("LAST NAME")){ String sql="Select * FROM tbl_students where LastName=?"; - - - - } i wish this come in handy.
Ответитьduus001 is right.Suppose the query below : select * from EmployeeInfo where name = ? OR surname = ? OR employeeID = ? Thus, our prepared Statement has to define 3 different parameters to search apparently in our database. So, the only solution is to separate seach field's content into 3 distinct values;tto do this, pass 3 distinct parameters into pst: pst.setString(1, searchJTextField.getText()); pst.setString(2, searchJTextField.getText()); pst.setString(3, searchJTextField.getText());
ОтветитьYes. That would also work. Just remember to add: pst.setString(2, txt_search.getText()); pst.setString(3, txt_search.getText());
Ответитьhow you took that button group for those buttons ??? please reply..
ОтветитьIs there no shorter way to do this? like instead of: "select * from Employeeinfo where name =?" There could be: "select * from Employeeinfo where name =? or employeeid =? or surname =?"
Ответитьjust replace if with while in the code that you use to search name and surname
Ответитьyes sir , we would be glad if you could give a solution for this problem, my problem is that what if there are multiple people with same name and we don't no their emloyeeid(unique id ) either . Thank you.
Ответитьwhat happen when there are two two person with the same name or two person with same surname. I hope you understand my question...
Ответить