Redian新闻
>
Quick jdbc question, help needed, thx!
avatar
Quick jdbc question, help needed, thx!# Java - 爪哇娇娃
j*1
1
【 以下文字转载自 Complain 讨论区 】
发信人: mitbbs (未名空间), 信区: Complain
标 题: Re: [投诉]TrustinJesus版主Dignity两天之内狂删我19篇主题帖
发信站: BBS 未名空间站 (Tue Jun 28 02:58:38 2011, 美东)
由于版内炸版,会引起误删。版主可恢复其误删的帖子
avatar
s*e
2
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!!
avatar
z*g
3
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

avatar
N*m
4
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

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。