473,326 Members | 2,173 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Help: System.Data.OleDb.OleDbException 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.OleDb.OleDbException' 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.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data
source= C:\Scorwin\data \Data.mdb";

cnnSCORE.Open();

OleDbCommand cmdSQL = new OleDbCommand(sSQL, cnnSCORE);

OleDbDataReader sdrSCORE = cmdSQL.ExecuteReader();

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

CnnSCORE.Close();

return result

}

Regards

gerrit esmeijer

(Netherlands)




Nov 16 '05 #1
3 5395
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.OleDb.OleDbException' 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.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data
source= C:\Scorwin\data \Data.mdb";

cnnSCORE.Open();

OleDbCommand cmdSQL = new OleDbCommand(sSQL, cnnSCORE);

OleDbDataReader sdrSCORE = cmdSQL.ExecuteReader();

/// 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.nl> 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.OleDb.OleDbException' 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.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data
source= C:\Scorwin\data \Data.mdb";

cnnSCORE.Open();

OleDbCommand cmdSQL = new OleDbCommand(sSQL, cnnSCORE);

OleDbDataReader sdrSCORE = cmdSQL.ExecuteReader();

/// 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.nl> 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.OleDb.OleDbException' 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.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data
source= C:\Scorwin\data \Data.mdb";

cnnSCORE.Open();

OleDbCommand cmdSQL = new OleDbCommand(sSQL, cnnSCORE);

OleDbDataReader sdrSCORE = cmdSQL.ExecuteReader();

/// 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
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...
7
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...
1
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...
0
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...
3
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...
0
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...
5
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...
0
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...
2
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.