473,396 Members | 1,891 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,396 software developers and data experts.

OleDbException 'unspecified error'

maylortaylor
72 64KB
So, i get the OleDBException "unspecified error" whenever the function below hits the
Expand|Select|Wrap|Line Numbers
  1. dataAdapter.Fill(dataset)
line.

I have tried adding
Expand|Select|Wrap|Line Numbers
  1. dbcommand.connection.close()
and
Expand|Select|Wrap|Line Numbers
  1. dbcommand.connection.dispose
() but neither fixed the problem.

I assume that this error would happen every time i try to connect with the DB but this is just the first function that does so in my code, so this is where the error is first occuring.

I have read online that MS Access will eventually clear out old connections after a while, if this is true, then i should just have to wait..but i dont want to keep waiting for nothing to happen.

Expand|Select|Wrap|Line Numbers
  1.  Function GetOrders(ByVal _numberrecords As Long) As DataTable
  2.         Dim TaxConnStr As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & ConfigurationManager.AppSettings("Database")
  3.         Dim dbConnection As OleDbConnection = New OleDbConnection(TaxConnStr)
  4.         Try
  5.             'Code to get orders in call status. Sort oldest to newest
  6.             ' dbConnection.Open()
  7.             Dim queryString As String
  8.             queryString = "SELECT TOP " & _numberrecords & " Orders.Control_Number, Orders.State, Orders.County, Orders.Status, Orders.ZipCode, Orders.OrderNumber, Orders.Client, Orders.Department "
  9.             queryString += "FROM Orders "
  10.             queryString += "WHERE(((Orders.Status) = 'Tax Cert Call' Or (Orders.Status) = 'Online')) "
  11.             queryString += "ORDER BY Orders.Date_Received;"
  12.             Dim dbCommand As OleDbCommand = New OleDbCommand
  13.             dbCommand.CommandText = queryString
  14.             dbCommand.Connection = dbConnection
  15.             Dim dataAdapter As OleDbDataAdapter = New OleDbDataAdapter
  16.             dataAdapter.SelectCommand = dbCommand
  17.             Dim dataSet As DataSet = New DataSet
  18.             dataAdapter.Fill(dataSet)
  19.  
  20.             If dataSet.Tables(0).Rows.Count >= 1 Then
  21.                 GetOrders = dataSet.Tables(0)
  22.             End If
  23.  
  24.         Catch ex As OleDbException
  25.             Console.WriteLine(ex.Message)
  26.             myLogger.Log(ex.Message)
  27.         Finally
  28.             dbConnection.Close()
  29.  
  30.             dbConnection.Dispose()
  31.         End Try
  32.  
  33.  
  34.     End Function
May 17 '13 #1

✓ answered by maylortaylor

Found the problem. My Access Database was corrupted. I just remade it and my program worked fine.

3 1743
vijay6
158 100+
Hey maylortaylor, line number 21 is correct in your 4th code?
May 18 '13 #2
maylortaylor
72 64KB
Is there no one out there that can help me? Is this really that hard of a problem? And yes, Vijay, it's correct.
May 20 '13 #3
maylortaylor
72 64KB
Found the problem. My Access Database was corrupted. I just remade it and my program worked fine.
May 20 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: kate_cha | last post by:
Hello, I'm new to .net, so this may be a really easy question....I have been working on a .net application - each web page pulls information from a an access database and writes it to the screen. ...
4
by: RM | last post by:
Had VS .Net 2002 installed on W2k Server SP3 and supported a number of web sites. Installed VS .Net 2003 on Friday and now all web sites using .Net & MS ACCESS get this strange error upon open. ...
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...
3
by: GotdotNet | last post by:
I get this error once in a while and I normally could fix it by restarting IIS. However, I would like to find out what causes this. Can anyone help? -----------------------------error...
1
by: Siegfried Heintze | last post by:
I'm using a third party hosting service. I presently have a Web Service on this hosting service's server that loads and executes a native mode DLL. This demonstrates that the hosting service has...
7
by: Jim McGivney | last post by:
ASPX page from VS.net-C# on host's computer using oleDataAdaptor to connect to Microsoft Access database. The page loads, but when connection to the database is attempted to fill a datagrid the...
0
by: Siegfried Heintze | last post by:
I have an ASP.NET web page that works greate from my machine. However, when I upload it to my hosting service, I get the error below. I am using impersonation in my web.config file to...
3
by: Jerry Spence1 | last post by:
I am starting up a number of threads. Each one specifies a connection to the same database. Sub ReaderThread() Dim cn As New System.Data.OleDb.OleDbConnection cn.ConnectionString =...
2
by: Dan | last post by:
This is the most excruciating error I have ever had to deal with in 10 years of programming with Visual Basic. I am getting an error albeit intermittent most of the time, but I am now getting it...
2
by: kanman | last post by:
hi all. im developing a web based application using asp.net i'm getting this error below: and idea on where the problem is and how to fix? thank you in advance Kanman
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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 project—planning, coding, testing,...

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.