AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

2 queries different days

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
polilop
Guest





PostPosted: Tue Mar 22, 2005 5:24 pm    Post subject: 2 queries different days Reply with quote



every day around 15.00 i fill my database
with data for the next day. i have a program that
has to take the newest (any random time of day)
data. So i made two queries, one that looks for the next day
and if that fails looks for current date.
i put the first query in a Try block and if that fails
i put the second in the catch block which i think
is not good becouse what if that second query fails?
any suggestions?


Back to top
Matt Humphrey
Guest





PostPosted: Tue Mar 22, 2005 7:04 pm    Post subject: Re: 2 queries different days Reply with quote




"polilop" <fmatosic (AT) inet (DOT) hr> wrote

Quote:
every day around 15.00 i fill my database
with data for the next day. i have a program that
has to take the newest (any random time of day)
data. So i made two queries, one that looks for the next day
and if that fails looks for current date.
i put the first query in a Try block and if that fails
i put the second in the catch block which i think
is not good becouse what if that second query fails?

There's nothing wrong with putting the second query into the catch block.
Keep in mind that you can still nest the second query in a try-catch block
and trap that error also.

try {
first query
} catch (Exception ex) {
try {
second query
} catch (Exception ey) {
// Can't get the data
}
}

Cheers,
Matt Humphrey [email]matth (AT) ivizNOSPAM (DOT) com[/email] http://www.iviz.com/



Back to top
polilop
Guest





PostPosted: Tue Mar 22, 2005 7:09 pm    Post subject: Re: 2 queries different days Reply with quote



thx thought i couldn't do that
"Matt Humphrey" <matth (AT) ivizNOSPAM (DOT) com> wrote

Quote:

"polilop" <fmatosic (AT) inet (DOT) hr> wrote in message
news:d1pkcn$l7o$1 (AT) sunce (DOT) iskon.hr...
every day around 15.00 i fill my database
with data for the next day. i have a program that
has to take the newest (any random time of day)
data. So i made two queries, one that looks for the next day
and if that fails looks for current date.
i put the first query in a Try block and if that fails
i put the second in the catch block which i think
is not good becouse what if that second query fails?

There's nothing wrong with putting the second query into the catch block.
Keep in mind that you can still nest the second query in a try-catch block
and trap that error also.

try {
first query
} catch (Exception ex) {
try {
second query
} catch (Exception ey) {
// Can't get the data
}
}

Cheers,
Matt Humphrey [email]matth (AT) ivizNOSPAM (DOT) com[/email] http://www.iviz.com/





Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.