craftleft.gif (3002 bytes)QuickTable
Home | API | Tutorial | Download | Support | Contact topblack.gif (108 bytes)


QuickTable User Cp  |  Register  |  Members  |  Search  |  Help
    |- QuickTable Discussion Forums > JDBC/Database Issues Post New Topic   Post A Reply
find() and selecting a row printer friendly version
next newest post | next oldest post
Author Messages
dajal_basher{@}hotmail.com
Unregistered
Edit or delete this message Reply w/Quote
Posted Wednesday, December 31, 1969 @ 23:59:59  

i'm writing an application, i have 5 textfields mututally exclusive textfields whic should search the database and view the selected results. i.e customer details, such as name, phone, addresss, id etc

when my application runs i seem to display all the reults in my table and when i click my search button nothing gets updated?

can u help?

admin{@}quicktable.org
Unregistered
Edit or delete this message Reply w/Quote
Posted Wednesday, December 31, 1969 @ 23:59:59  

Please have a look at Customerorderdemo.java sample which is in your samples directory. That explains how to do this. The find() method won't do any search in database. Find() is used to search the results in quicktable. when you want to search in database you have to recreate the select statement based on the search condition and then call the refresh() method. For example , in your case if the user enters only the customer name, change the select statement such that select * from customer_table where customer_name= (value from text field), then call teh refresh() method, now the table will be refreshed with new data.

The following piece of code is taken from customerorderdemo.java, which does a similar stuff

public void showProducts()
{
//since users may switch between the order & product information through the combo box selection
//clear all the update/insert/delete sqls which are set before
//if you don't set any update/insert/delete sqls, you don't need to call this
dBTable1.clearAllUpdateSql();
dBTable1.clearAllInsertSql();
dBTable1.clearAllDeleteSql();

try
{
// set the select sql to get data from the product table
dBTable1.setSelectSql("SELECT * from Product");

//update the changes based on product number
dBTable1.addUpdateSql("update order set Product_name=? where Product_Number=?","2,1");

//Add the insert statements
dBTable1.addInsertSql("insert into order (Product_Number,Product_Name) values (?,?)", "1,2");

//Add delete statements
dBTable1.addDeleteSql("delete from order where Product_Number = ?", "1");

//fetch the data from database to fill the table
dBTable1.refresh();

}
catch(SQLException e)
{
e.printStackTrace();
}

}

Post New Topic   Post A Reply Jump to:
Contact Us | QuickTable - A Java DBGrid | Privacy Policy All times are GMT -5 Hours.
Welcome to QuickTable Forums, Guest!  
Login
Username :
Password :
In order to fully utilize the abilities of this board, you are required to register as a member. Registration is free, and allows you to do lots of things including turning on or off certain features of this board. Register now!
Powered by CuteCast v2.0 BETA 2
Copyright © 2001-2003 ArtsCore Studios