 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
polilop Guest
|
Posted: Tue Mar 22, 2005 5:24 pm Post subject: 2 queries different days |
|
|
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
|
Posted: Tue Mar 22, 2005 7:04 pm Post subject: Re: 2 queries different days |
|
|
"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
|
Posted: Tue Mar 22, 2005 7:09 pm Post subject: Re: 2 queries different days |
|
|
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 |
|
 |
|
|
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
|
|