User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 391,593 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,683 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 2311 | Replies: 6
Reply
Join Date: Jul 2005
Posts: 23
Reputation: chiwawa10 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 2
chiwawa10 chiwawa10 is offline Offline
Newbie Poster

Help CDBException can't solve problem

  #1  
Jul 21st, 2005
Hi all,

I'm facing this problem in my running app. It is a real-time app and writes to the database whenever data is received. However, there is rare occasions that causes the ExecuteSQL to fail. However, the failure did not throw any exception, so my CDBException did not detect anything(it is written in a try/catch).
I suspect that the data fail to insert into the database due to the database is being used heavily. Is CDBException able to catch this kind of error? Is there any way that I can solve this problem?
Or is it other problem(what are the error that CDBException can't handle)?

Thank you...
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2003
Location: Canada
Posts: 786
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Rep Power: 9
Solved Threads: 25
Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: CDBException can't solve problem

  #2  
Jul 22nd, 2005
Not entirely sure, but you could try replacing the CDBException with AfxThrowDBException, which is the Global Error Exception (includes CDBException) and it may give you a more definitive message.
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
Reply With Quote  
Join Date: Jul 2005
Posts: 23
Reputation: chiwawa10 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 2
chiwawa10 chiwawa10 is offline Offline
Newbie Poster

Re: CDBException can't solve problem

  #3  
Jul 24th, 2005
Dear paladine,

part of my code is like this:

TRY{
ExecuteSQL(...) //query to insert data into database
}

CATCH(CDBException e){
.....
}


*the situation that i face is the CDBException does not capture anything even though the data is not successfully inserted(especially when the database is busy). Do you know what is wrong???

Please advise...
Reply With Quote  
Join Date: Feb 2003
Location: Canada
Posts: 786
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Rep Power: 9
Solved Threads: 25
Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: CDBException can't solve problem

  #4  
Jul 25th, 2005
OK, maybe I missed something. How do you know that ExecuteSQL has failed? By checking the DB? Is there any error message generated?

If the DB is that busy, consider using Transactions so to at least provide debug ability and reduce the chance of data corruption.

I am really curious has to how you know it fails, and the code in and around that statement.
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
Reply With Quote  
Join Date: Jul 2005
Posts: 23
Reputation: chiwawa10 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 2
chiwawa10 chiwawa10 is offline Offline
Newbie Poster

Re: CDBException can't solve problem

  #5  
Jul 25th, 2005
ohh.. I found out that error occurs by checking the DB. There are some data not inserted into the DB but the program did not throw any CDBException. If it had thrown any exception, the error would have been logged to a file which I explicitly wrote(writing the m_strError to the log file).

Locking the database is not an option because the database must be accessible by another program which is continuously reading data from it.
This is a time critical/real-time program.

Is there any problem that you know of, that the CDBException cannot handle?
thank you...
Reply With Quote  
Join Date: Feb 2003
Location: Canada
Posts: 786
Reputation: Paladine has a spectacular aura about Paladine has a spectacular aura about Paladine has a spectacular aura about 
Rep Power: 9
Solved Threads: 25
Colleague
Paladine's Avatar
Paladine Paladine is offline Offline
Master Poster

Re: CDBException can't solve problem

  #6  
Jul 25th, 2005
Not that I know of. by why not do this as a transaction, that way it would be an all or none, and it may provide you a better idea of when/why it is failing?
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
Reply With Quote  
Join Date: Jul 2005
Posts: 23
Reputation: chiwawa10 is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 2
chiwawa10 chiwawa10 is offline Offline
Newbie Poster

Solution Re: CDBException can't solve problem

  #7  
Jul 25th, 2005
ok... how can I implement transaction in my code?
I know there is a function called BeginTrans() but since I'm using ExecuteSQL(), is it relevant?
any example would be nice, thank you!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ASP.NET Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 11:27 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC