473,586 Members | 2,495 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help: System.Data.Ole Db.OleDbExcepti on Error

Friends,

The following code works fin. BUT...
after a >> couple times<< this code is used is a class it comes with an
error saying
unhandled System.Data.Ole Db.OleDbExcepti on' occurred in system.data.dll
Any suggestions what could be wrong.

public int LeesRadSoort( string radcode ) {

string sSQL = "SELECT * FROM Rad WHERE RadCode = '" + radcode + "';";

OleDbConnection cnnSCORE = new OleDbConnection ();

cnnSCORE.Connec tionString = @"Provider=Micr osoft.Jet.OLEDB .4.0; Data
source= C:\Scorwin\data \Data.mdb";

cnnSCORE.Open() ;

OleDbCommand cmdSQL = new OleDbCommand(sS QL, cnnSCORE);

OleDbDataReader sdrSCORE = cmdSQL.ExecuteR eader();

/// code that is making some calculations -> result

CnnSCORE.Close( );

return result

}

Regards

gerrit esmeijer

(Netherlands)




Nov 16 '05 #1
3 5413
G.Esmeijer wrote:
Friends,

The following code works fin. BUT...
after a >> couple times<< this code is used is a class it comes with an
error saying
unhandled System.Data.Ole Db.OleDbExcepti on' occurred in system.data.dll
Any suggestions what could be wrong.

public int LeesRadSoort( string radcode ) {

string sSQL = "SELECT * FROM Rad WHERE RadCode = '" + radcode + "';";

OleDbConnection cnnSCORE = new OleDbConnection ();

cnnSCORE.Connec tionString = @"Provider=Micr osoft.Jet.OLEDB .4.0; Data
source= C:\Scorwin\data \Data.mdb";

cnnSCORE.Open() ;

OleDbCommand cmdSQL = new OleDbCommand(sS QL, cnnSCORE);

OleDbDataReader sdrSCORE = cmdSQL.ExecuteR eader();

/// code that is making some calculations -> result

CnnSCORE.Close( );

return result

}


enclose the ExecuteReader() statement with a try/catch clause andCatch the
OleDbException. In that exception, you'll find an Errors collection which
contains the actual error. See the OleDbException docs for details. By
checking this collection, you can determine what's wrong.

FB
--
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP
Nov 16 '05 #2
Frans,

Thanks for your reply... however, in spite of the fact that I have done what
you suggested, this error is not caught by the try catch construction. I
keeps pointing at the same line and the error is not caught. Thanks anyway

Gerrit Esmeijer
"Frans Bouma [C# MVP]" <pe************ ******@xs4all.n l> schreef in bericht
news:xn******** *******@msnews. microsoft.com.. .
G.Esmeijer wrote:
Friends,

The following code works fin. BUT...
after a >> couple times<< this code is used is a class it comes with an
error saying
unhandled System.Data.Ole Db.OleDbExcepti on' occurred in system.data.dll
Any suggestions what could be wrong.

public int LeesRadSoort( string radcode ) {

string sSQL = "SELECT * FROM Rad WHERE RadCode = '" + radcode + "';";

OleDbConnection cnnSCORE = new OleDbConnection ();

cnnSCORE.Connec tionString = @"Provider=Micr osoft.Jet.OLEDB .4.0; Data
source= C:\Scorwin\data \Data.mdb";

cnnSCORE.Open() ;

OleDbCommand cmdSQL = new OleDbCommand(sS QL, cnnSCORE);

OleDbDataReader sdrSCORE = cmdSQL.ExecuteR eader();

/// code that is making some calculations -> result

CnnSCORE.Close( );

return result

}


enclose the ExecuteReader() statement with a try/catch clause andCatch the
OleDbException. In that exception, you'll find an Errors collection which
contains the actual error. See the OleDbException docs for details. By
checking this collection, you can determine what's wrong.

FB
--
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP

Nov 16 '05 #3
G.Esmeijer wrote:
Frans,

Thanks for your reply... however, in spite of the fact that I have done what
you suggested, this error is not caught by the try catch construction. I
keeps pointing at the same line and the error is not caught. Thanks anyway
What's the code after you've enclosed the code with try/catch statements? If
the code you originally posted throws an OleDbException, it has to end up in
the catch. Did you position the try statement at the right spot? Could you
post that snippet with the try/catch?

Frans.

Gerrit Esmeijer
"Frans Bouma [C# MVP]" <pe************ ******@xs4all.n l> schreef in bericht
news:xn******** *******@msnews. microsoft.com.. .
G.Esmeijer wrote:
Friends,

The following code works fin. BUT...
after a >> couple times<< this code is used is a class it comes with an
error saying
unhandled System.Data.Ole Db.OleDbExcepti on' occurred in system.data.dll
Any suggestions what could be wrong.

public int LeesRadSoort( string radcode ) {

string sSQL = "SELECT * FROM Rad WHERE RadCode = '" + radcode + "';";

OleDbConnection cnnSCORE = new OleDbConnection ();

cnnSCORE.Connec tionString = @"Provider=Micr osoft.Jet.OLEDB .4.0; Data
source= C:\Scorwin\data \Data.mdb";

cnnSCORE.Open() ;

OleDbCommand cmdSQL = new OleDbCommand(sS QL, cnnSCORE);

OleDbDataReader sdrSCORE = cmdSQL.ExecuteR eader();

/// code that is making some calculations -> result

CnnSCORE.Close( );

return result

}


enclose the ExecuteReader() statement with a try/catch clause andCatch the
OleDbException. In that exception, you'll find an Errors collection which
contains the actual error. See the OleDbException docs for details. By
checking this collection, you can determine what's wrong.

--
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP
Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
5275
by: silesius | last post by:
I've been using VS 2003 to develop a webapplication using C#. Today I exported the application to a remote webserver I begun experiencing problems. It's a simple application that retrieves some information from an Access database. It worked fine when I ran on my computer. I use a parameterized query to retrieve some customer specific...
7
2572
by: Steve B. | last post by:
Does anyone know why the DA Update() would throw an exception? I moved the database but I updated the Conn and the DA, currently (trying)removing/replacing DS. Is there a another direction I should be looking in? Does it matter if I move columns in the grid (everything is a string anyways)? Does the DS need to be udated from the DT?...
1
6842
by: T8 | last post by:
I have a asp.net (framework 1.1) site interfacing against SQL 2000. It runs like a charm 99% of the time but once in a while I get the following "unspecified error". Sometimes it would resolve by itself (asp.net recycled?); it also can be solved by restarting IIS. Any ideas what cause(s) this to happen? System.Data.OleDb.OleDbException:...
0
2751
by: silesius | last post by:
I've been using VS.NET 2003 to develop a webapplication using C#. Today I exported the application to another webserver I begun experiencing problems. It's a simple application that retrieves some information from an Access database. It worked fine when I ran on my home computer. I use a datagrid witha a dataset and a parameterized query...
3
8820
by: Brian Foree | last post by:
I am developing an ASP.NET application that uses Access 2000 as its backend, and have just started getting the following error on 2 ASP.NET pages that had been working until late last week (and I don't think I made any changes to either page other than changing the user control that creates the header). Server Error in '/myApp' Application....
0
5639
by: NicK chlam via DotNetMonster.com | last post by:
this is the error i get System.Data.OleDb.OleDbException: Syntax error in INSERT INTO statement. at System.Data.Common.DbDataAdapter.Update(DataRow dataRows, DataTableMapping tableMapping) at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable) at System.Data.Common.DbDataAdapter.Update(DataSet dataSet) at...
5
9637
by: petro | last post by:
Hello all, My asp.net web application works on my machine but I get the following error on our test web server, There is only one oracle home on the test server. Does anyone know how to resolve this error? Oracle error occurred, but error message could not be retrieved from Oracle. Description: An unhandled exception occurred during the...
0
1635
by: John G | last post by:
I have been using Oracle Helper to connect to my oracle 9i Db. When excute text it works fine, but when I try to execute a store procedure I get the following error message. I searched everyplace for a solution. System.Data.OleDb.OleDbException: ̸Ώ System.Data.OleDb.OleDbCommand.ExecuteCommandTextForMultpleResults(tagDBPARAMS...
2
1528
by: johnmay1248 | last post by:
I am having a problem with queries running in this code When I use the query "SELECT * FROM sample" the code runs and the data grid binds and shows the contents of the sample table. If I change the query to filter the results such as "SELECT * FROM sample WHERE (sales 2000)" the code fails on - objDataReader =...
0
7915
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main...
0
7841
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8204
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
6617
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5712
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3838
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1184
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.