473,320 Members | 2,006 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,320 software developers and data experts.

OleDbDataReader ????

Hi...

I am trying to trying to execute a database reader and i keep getting the
following exception error...

{"IErrorInfo.GetDescription failed with E_FAIL(0x80004005)." }
System.Exception

I have not idea what this error means, or how to resolve the issue, if you
have any suggestions please let me know. The code i am running is as
follows....

int ID = 0 ;
OleDbConnection Connection = new OleDbConnection() ;

try {
//Database Connection

Connection.ConnectionString = AppMain.CompanyConnectionPath ;

OleDbCommand Command = new OleDbCommand("Select * From tbl WHERE LOWER <=" +
51.01 + " AND UPPER >=" + 51.01, Connection) ;

//Open the connection

Connection.Open();

//Create an instance of a data reader

OleDbDataReader Reader ;

//Setup data reader CommandBehavior.CloseConnection

Reader = Command.ExecuteReader(CommandBehavior.CloseConnect ion) ; // error
occurs here!
while(Reader.Read()) {

//Chart of Accounts Information

pID = Convert.ToInt32(Reader["ID"]) ;

}

Reader.Close() ;

Command.Dispose() ;

}

catch(Exception e) {

MessageBox.Show(e.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error) ;

}

finally {

Connection.Close() ;

}

return pID ;


Nov 16 '05 #1
1 1700
Hi,

The same works fine on my machine!

Not sure what the exact cause of the error is.

Did you try by directly executing the DataReader without
any parameters
myReader = myCommand.ExecuteReader
(CommandBehavior.CloseConnection);

instead use
myReader = myCommand.ExecuteReader(); and see what the
behaviour.

Also, I ran the same code on my machine that has .NET 1.1
and VS.NET 2003

Thanks,
irfan
Nov 16 '05 #2

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

Similar topics

3
by: Buddy | last post by:
Hello, How do I get the number of row retrieved on a SELECT query when using OleDbDataReader? I am using Framework 1.0.
10
by: Dion Heskett | last post by:
I wish to supply the formating as a parameter, I have tried OleDbDataReader but get a null ref. just can't seem to get this to work. I think this has something to do with ExecuteReader. also...
7
by: Smitty | last post by:
I have a function that imports an Excel file into an Access table using SQL. I then close the OleDataReader and the OleDbConnection, then dispose the OleDbCommand, then OleDbConnection. The calling...
1
by: Claudia Fong | last post by:
Hi, I'm using the oleDbDataReader HasRows properties to detect wheter my table contains a record with the parameter below: oleDbConnection1.Close(); objreturnst.Parameters.Value =...
0
by: Steve1 via DotNetMonster.com | last post by:
Hi all, I''ve created an OleDbDataReader that will contain the number of records that the used SQL query will return. I'm then using a while loop to loop while the OleDBDataReader object has...
1
by: Keith | last post by:
Hi, if have this method in a cs file that connections to a database and returns a datareader to my web form. public OleDbDataReader GetDataReader(string theSQL) { theConn = new...
1
by: Steven K | last post by:
Hello, I am using the following code which works. My question is does the OleDbDataReader need to be closed and then re-executed for every control? Is there a more effecient way of doing this...
1
by: Rob Richardson | last post by:
Greetings! I have a database created in MS Access that has some fields containing Currency data. Every time I try to use one of the OleDbDataReader's GetXXX() methods to read it, I get an...
3
by: Nexus | last post by:
I'm currently using .NET version 2003. I want to be able to retrieve records. How do I do so using the OleDbDataReader? Can I have some codes as an example?
1
by: Jerry Spence1 | last post by:
I have been doing the following is VB.Net 2003: Dim dr1 As OleDbDataReader .....Code here If Not dr1 Is Nothing Then
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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)...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.