s****e 发帖数: 68 | 1 hi, i want to first check whether the table in Access
is empty. if empty, create it, not, delete the data
and add new data. my code is like:
ResultSet rs = stmt.executeQuery("Select * from IBM");
//assume IBM is the table name in database
if(rs.next())
{...delete and add...}
else
{...create...}
My question is: the database is an empty one and when run
the program, java always complain that can not find table
IBM in the 1st sentence. How can i do about it? thanks a lot!!
| z****g 发帖数: 2497 | 2 add a try catch block.
like this
try
{
// select * from IBM
if(rs.next())
{
//delete and add
}
}
catch()
{
//create table
}
【在 s****e 的大作中提到】 : hi, i want to first check whether the table in Access : is empty. if empty, create it, not, delete the data : and add new data. my code is like: : ResultSet rs = stmt.executeQuery("Select * from IBM"); : //assume IBM is the table name in database : if(rs.next()) : {...delete and add...} : else : {...create...} : My question is: the database is an empty one and when run
| N***m 发帖数: 4460 | 3 that's why we use hibernate.
【在 s****e 的大作中提到】 : hi, i want to first check whether the table in Access : is empty. if empty, create it, not, delete the data : and add new data. my code is like: : ResultSet rs = stmt.executeQuery("Select * from IBM"); : //assume IBM is the table name in database : if(rs.next()) : {...delete and add...} : else : {...create...} : My question is: the database is an empty one and when run
|
|