Unexpected error from external database driver while importing file - c#

when i try to import excel in winform application(C#) i got error.
Error Message -> "Unexpected error from external database driver"

It seems to be an issue with the latest Microsoft update (KB4041687). A couple of our customers had this problem this morning. The update seems to have had a somewhat adverse effect on the Microsoft.Jet.OLEDB.4.0 driver with regard to Excel connections. This is just one of many problems with this particular update.
See article here.
I advised our customers to roll back the update and everything started working again. Obviously this is a temporary solution but until such time as a fix is available it's all I could advise.

Related

New C# project cannot open ACCDB microsoft database file

I recently had a new project assigned to me (I'm new to C# and I'm a junior). It makes use of a Microsoft access database file (.accdb file)
I've imported the project into Visual Studio but I can't for the life of me run the code. Initially I had file register issues, and I think I managed to resolve that by getting the IT teams to install a "2007 Office System Driver: Data Connectivity Components" driver from the Microsoft website.
Bow the error says:
System.Data.OleDb.OleDbExceptions: 'Cannot open database''. It may not be a database that your application recognizes, or the file may be corrupt.'
The team I'm trying to help only has one dev (working from a different country) who is the main person to handle the code. It works on her side, but she doesn't really have the experience to help me troubleshoot this.
I tried sending her my database file, for her to swap her file for mine, and she said it was still working, so it sounds like the issue might not be to do with the file?
Could I get any help if possible? So far my only approach is to keep googling the error.
But the only resolutions I see are from people who have database files nearing their file size limit (2GB). My database file is just 1MB.
The database file is password protected (the password happens to be in the code). I opened the database file (Microsoft access opens) and entered the password and I had no issue accessing the data)
Out of luck, I managed to find the right article to help me!
The issue with Microsoft access database files is only one user can really use then at a time I believe.
I saw a forum about potential locks made by other users. I googled how to remove locks but it seems that it might not be a lock issue (Microsoft creates a lock file which I dont have).
Regardless, I assumed that the issue is still somewhat similar. Since I had access to the database in Microsoft Access, I decided to open a new database, then go to external data tab and click on access to import EVERYTHING from the other file. Then I just renamed to old file and give my new file the original name.
I reran the code and it worked!
I dont know why the other dev had no issue opening the file. My assumption is that because she is the only developer her laptop is already 'set up' in some way to run everything as normal, whereas if someone new tried (or if something happens and she has to re-open the code on a new laptop) they would have to try and replicate the 'set up' or try and work from scratch
Hope this helps

Diagnosing Google Fusion Table update using API to upload CSV issue

I'm trying to diagnose issues updating Google Fusion Tables using CSV data via the API. Everything seems to work correctly code side of things with no errors reported but the data does not reflect the changes. Any ideas how I can diagnose what is going wrong?
I've been using the Google.Apis.Fusiontables.v2 C# libraries (v1.27.1.833 is latest I've tried) to update a fusion table daily. The process was working seamlessly for quite a while, but now no longer seems to work. I suspect the process has been broken for a month or more now.
Everything seems to work from the code side of things, no errors reported. I've also been debugging the process from within Visual Studio with no problems indicated - it just seems to work from the client side.
In case it's useful the C# method I'm using is:
fusiontablesService.Table.ReplaceRows(tableId, stream, "application/octet-stream").Upload();
The table I am attempting to update is - https://fusiontables.google.com/DataSource?docid=1ndrFm1g0iZpz5gszjz5Ij9r_KiQbNYRXVM2JNfv3
The UpdatedUtc column indicates that a few updated rows are getting through, but not all of them.
If I export my CSV stream to a physical file and created a new Fusion Table manually via the web UI this works perfectly and shows all the missing data I expect to be there.
Here's the zipped CSV file in case it's useful - http://www.paydirt.co.nz/stackoverflow/GoldPermits.zip
This is the test Fusion Table I imported the CSV file manually into - https://www.google.com/fusiontables/DataSource?docid=1Udnre88O8e1zokvnhrkmqdY7BbYD2OQtELdyz3uG
Example of missing data in the live table updates:
Compared to the test table created from the same data:
The PERMIT_NUMBER's for the 2 missing rows in the example are 60304 and 60247.
Any ideas how I can investigate further what might be going wrong? Maybe there's some logs or logging options available somewhere I'm unaware of?
Any help / ideas to explore is greatly appreciated.
Upload from fusiontablesService.Table.ReplaceRows(...).Upload() returns a Google.Apis.Upload.ResumableUpload.ResumableUploadProgress object which has both aStatus and Exception property that can be checked.
In my case I was getting the following progress result:
{Google.Apis.Upload.ResumableUpload.ResumableUploadProgress}
BytesSent: 10485760
Exception: {"Google.Apis.Requests.RequestError\r\nContent has a different number of columns than the table (line 1). [400]\r\nErrors [\r\n\tMessage[Content has a different number of columns than the table (line 1).] Location[ - ] Reason[badImportNumColumnsMismatch] Domain[fusiontables]\r\n]\r\n"}
Status: Failed

Visual Studio is trying to connect SQL database while loading a solution. Gives error: Cannot open database requested by the login

I've got a Visual Studio solution on which I had been playing with few C# projects related to Entity Framework coding.
I was creating some test databases to connect to and learn db first and code first approach. The problem is now every time I try to open the solution containing those projects, for some weird reason Visual Studio, or the solution or some project in it tries to connect to those databases. It gives an error as I've deleted those databases:
Cannot open database "Company" requested by the login. The login
failed. Login failed for user "administrator".
Here is the error message snapshot:
I get this error one by one for several databases. But I'm wondering why would VS try to connect to some database just while loading the solution? In case anyone else has faced this situation or know the reason behind it then that will be really great.
Note: The tags in the question I've put is only due to the environment I was working into. I'm trying to reach to a point to figure out if my problem is specifically related to those areas.
TL;DR; Delete the inactive/invalid SQL Server connections marked with a red cross in the Server explorer window of Visual Studio to get rid of the issue. SQL Server connections become invalid/stale whenever you delete the corresponding database from SQL Server but Visual Studio doesn't know about it and keeps trying unnecessarily.
Details: As correctly suggested by #stuartd, the Server Explorer in Visual Studio was messing up. Posting the answer in case it helps anyone else as well.
I realized that every time I was adding an ADO.NET Entity Data Model file for Entity Framework into my project as shown below it was adding a SQL connection node in Server Explorer window as shown below.
The connection was corresponding to the DB I chose in the ADO.NET entity data model addition wizard. I see that there is red cross against few of them since I've deleted the databases from SQL Server instance. Whenever you load a solution Visual Studio will always try to refresh the connection of all the databases currently found in Server Explorer. In fact in the case of DBs which have a red mark against them (as they are deleted) I'm sure VS must be employing the retry logic as well while trying to make a connection with the database. All this takes and wastes time as far as the loading time of a solution is concerned.
How to resolve the error: I deleted the inactive/unused connections marked with a red cross to get rid of the issue. It will be great if someone knows a way to mark the connections as inactive i.e. the connections live in the Server Explorer but VS shouldn't try connecting them every time until I ask it to refresh or may be it can refresh when I expand its node.
I also observed that Visual Studio somehow maintains these server explorer connections on a per solution file basis, may be in *.suo files. I had to delete those stale connections after opening every solution which were facing this error related to DB connection issue while getting loaded in Visual Studio. All solutions facing this issue somehow had at least one project related to entity framework :).

Driver Installed - Still cannot use OleDB reader

I have code in a Provider-Hosted App for SharePoint which calls the OleDBDataReader class in order to parse a .xslx file. In my development environment, the following exception appeared until I installed this driver.
The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. I have moved to pre-production, and the error has popped up again even though the admins of the IIS box are swearing back and forth that the driver is installed. They've sent me a screenshot of the install, and it looks like it's the same version I have. They refuse to uninstall and reinstall it since another application is apparently relying on it at the moment. Is there anything else that I can do on my end other than rewrite the code to look at some way of parsing the .xslx file using its stream instead?
I have read through many of the other topics about this, and I can't seem to find anyone doing something differently.
This thread seems to be about a similar error(granted it's for Access database), but the solution may be able to help with your problem:
In that thread the OP also installed the drivers you've linked ,that also failed so s/he installed these drivers:
http://www.microsoft.com/download/en/confirmation.aspx?id=23734
which worked apparently , try that.
I did a quick search on MSDN and the alternative download for your issue is the Office System Driver: Data Connectivity Components
The solution was for the engineering team to complete "repair" on the installation from add/remove programs.. This took forever to have them try, but it worked!

Foxpro - Error 15: "Not A Table"

I'm working on a C# application that reads/saves data in some old dbf-files.
(using Microsoft Visual FoxPro - driver)
I haven't had any problems until recently, when i tried querying a table i had'nt used before and i got this error message. This table is somewhat special since it has 500+ columns, i suspect that this might have something to do with it - but nothing I've googled so far gives any indications to this causing any problems.
I've had a look at this document and checked that the header record count matches the actual count (1 record);
This document is the only good tip I've found so far, that does not require any heavy dbf-repair tools.
I've tried using both the Microsoft Visual FoxPro - and the VFPOLEDB driver, they both give more or less the same error message.
I've tried passing the TableValidate = 0 command, without success.
Does anybody have any experience with a way to solve/work around this, preferably using C#.
VFP tables don't support 500 columns, so this isn't a VFP table. You need to find out what kind of table it is and use the appropriate driver to open it.
If the table is damaged, you can use CmRepair.app to fix it. This program is a Visual Foxpro 8 application (not a compiled .EXE), so you need VFP to execute it.
If you don't have VFP installed, you can download an utility program I made to execute VFP scripts and .APPs in customers that haven't VFP installed. The VFP8 runtimes are available here. Then you run the program with runner CmRepair.app and repair the table.
Good luck!
From the comment from Tamar, it got me to thinking of yet another application database that used .DBF file formats... Clipper. Here's a link that describes their table capacities..
Apollo database - (Clipper)
This might be a missing link you are looking for.

Categories