-
July 12th, 2005, 11:34 AM
#1
Registered User
VB.NET - OleDBException when trying to use the fill method on a dataset
Code:
Dim nwindConn As OdbcConnection = New OdbcConnection("Driver={SQL Server};Server=localhost;" & "Trusted_Connection=yes;Database=northwind")
Dim selectCMD As OdbcCommand = New OdbcCommand("SELECT CustomerID, CompanyName FROM Customers", nwindConn)
selectCMD.CommandTimeout = 30
Dim custDA As OdbcDataAdapter = New OdbcDataAdapter
custDA.SelectCommand = selectCMD
nwindConn.Open()
Dim custDS As DataSet = New DataSet
custDA.Fill(custDS, "Customers")
nwindConn.Close()
This code (only the names and connection string changed), for some reason, is throwing an OleDBException.
"I aspire sir, to be better than I am." -- Data, Star Trek: Nemesis
-
July 12th, 2005, 01:16 PM
#2
Registered User
I did some more digging, and the description of the exception is the "IErrorInfo.GetDescription failed with E_FAIL(0x80004005)", which I figure is compilerspeak for "you're hosed but I have no clue why"
The SQL statement in question is "SELECT * FROM <tablename>" It seems to only fail on a particular table in the database.
EDIT: Nevermind - the table itself was hosed. Copying data to a new table fixed the issue.
Last edited by 10of40; July 12th, 2005 at 01:24 PM.
"I aspire sir, to be better than I am." -- Data, Star Trek: Nemesis
-
November 10th, 2005, 05:32 PM
#3
Hi,
even though it passed a long time since the last post, the information might still be helpfull.
I also had this problem in some ocasions and I solved it by reseting IIS. The cause could have been an error while processing the page and the Access DB or table got locked, I'm not sure.
By reseting IIS all the resources that were in use were freed, the DB was queried and the results displayed properly.
One thing to pay attention is that it is not enough, at least it was not in my case, to stop and start IIS by using the buttons in the IIS Administration window. This actions only stops and starts (I know, just like the name says ) but doesn't reset it.
To reset the IIS, I used the following:
Select Start/run and in the text area type iisreset which will open a DOS window and display a couple of lines describing what is happening.
After IIS was shutdown and restarted the problem should be solved.
I hope it helps.
----------------------
http://www.webdp.net
-
November 12th, 2005, 09:27 AM
#4
Driver Terrier
Welcome to Windrivers jms and thanks for the tip.
Never, ever approach a computer saying or even thinking "I will just do this quickly."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|
Bookmarks