New C# project cannot open ACCDB microsoft database file - c#

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

Related

Using DeviceEnumeration - connecting IP based camera to windows

I am needing some help. Not very strong into coding but I need to understand why something isn't running for me.
I need to be able to connect an IP based camera to Windows. This is a new feature for windows when 1903 was released. If you look at the link below you will see what I'm referring to.
https://www.howtogeek.com/443847/windows-10-is-getting-built-in-support-for-network-cameras/
The issue is - the cameras I'm using require a password. This is not as simple as going in and adding the device manually. If you see the document below, the "Custom device" pairing is what I'm needing done.
https://learn.microsoft.com/en-us/windows/uwp/devices-sensors/pair-devices
As you can see this has to be coded to accomplish what I need. So this source code was referred to in the link below as something that should be able to do it.
https://github.com/microsoft/Windows-universal-samples/tree/master/Samples/DeviceEnumerationAndPairing/cs
Doing this in C#. Edit: I made sure to put all the shared files in the CS folder.
I'm using Visual studio and i pulled up the entire project but when I run it i'm getting an error that "The parent file, 'Scenario1_DevicePicker.xaml', for the file 'Scenario1_DevicePicker.xaml.cs' cannot be found in the project file.
I get that error for each .cs and .xaml.cs file there is. (Scenarios 1-9)
Can anyone help me out? Perhaps nudge me in the right direction?

Database solution based on MS Access

I have a pretty strange question for you:
At my office, my colleagues save data in a shared Excel document, which crashes very often due to the shared file format, and the many users who use it at the same time.
I tried to create an Access based solution with forms, and it worked pretty well, until it turned out - in the middle of "development", half of my colleagues have x64 OS and the other half have x86 architecture, so most of the VBA code cannot be used - smaller problem - , and the published code is not executable on x64...
My question is: If I build a Windows form that connects to a backend Access database, can I get rid of the x64-x86 problem? Saving to database file will be faster/safer than using the Excel format or I can start everything from scratch after 4 weeks of usage of the access solution? (Probably 20 users max)
And here comes the fun part...I have to cook from what I have :D I have no available SQL server, no Visual Studio at the office... so I have to build a portable WinForm with app configs at home to connect to the access database, saved at our shared network.
What do you think is this possible solution? Or should I try to find a different one?
Many thanks in advance:
Matt

VS2015 New web form pages created empty

Ive been away from .Net web dev for a few years and am now coming back to it inorder to update a client project. I've installed VS Pro 2015(legit no cracks) and am now experiencings some odd behaviours both with the project/website files and VS.
The first 'issue' I need to tackle is that when adding a new master page or webform to the project, these new documents appear completely empty. There is no code or markup generated in the documents eg: 'docname.master', 'docname.master.cs', 'pagename.aspx', 'pagename.aspx.cs'.
I doubt this is the correct, behaviour since it wasn't in the past. So have things changed, and this is expected, and I need to get up to speed. Or, is there something wrong with my set-up -which I expect- ? If so, do you have any ideas what I'm doing wrong? What can I do to rectify this?
UPDATE
I've just done some testing on a different machine and it appears that this seems to be connected to the fact that the files I've been working with are located on a network file server. Is this a known issue, and are there any fixes/workarounds?
In my case it turns out that the cause of this and several other issues was purely down to the fact that the project files I was working with were located on a network drive.
It appears that this is a fairly common problem, especially when access to the network / remote drive is quite slow.
Simply switching the project files to a local drive fixed all the problem I was experiencing.

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!

Windows Phone 8 UnauthorizedAccessException when opening file

I am having a very strange error when trying to access a ".stl" file in the "Stl" folder of my application when the app is downloaded from the Windows Phone Marketplace. It does not exhibit this behavior when it is launched from Visual Studio 2012 Express in either debug or release mode. Once I try loading a file it gives me an "System.UnauthorizedAccessException Access to path 'C:\Data\Programs\APPUID\Install\Stl\test.stl' is denied" exception while accessing a ".gcode" file in an almost exactly the same fashion from the "GCode" causes no error what so ever.
I have no idea what could be causing this or how to debug this because I don't know if I can somehow attach the debugger to an instance of the store downloaded app.
I also have no idea what could possibly be different between deploying the exact same app from the store and from Visual Studio. The Visual Studio installed app also does not give any troubles if the app is launched from the phone without the debugger being attached.
Any ideas?
PS. The file is being opened by a filestream which is then used by a binarreader. I am not sure if the source code is really needed and for which part but the important line is just:
FileStream fileStream = new FileStream(filePath, FileMode.Open);
Where "filePath" in this case is "Stl\test.stl".
Without seeing your actual code it is hard to say what the problem is. So instead of attempting to read your mind I will offer an alternative solution.
I have worked extensively with Isolated Storage on the Windows Phone and I have learned this.
There is no library, no API, no SDK, no Web service, in the world, that has worse error reporting than the Isolated Storage on windows phone.
EVERYTHING is Invalid Access or Unauthorized Access with ZERO further information.
To remedy this I created a DLL that serializes objects to the Isolated Storage for you.
All you have to do is put [DataContractAttribute] above your class name and [DataMemeber] above any variable you want saved. Then you just pass your object and unique name into the savefile method. That's it! Instant save
You can find my free DLL EZ_Iso.dll for download here. With example code and instructions
The code is open source so if you wish you may also decompile the dll and see how it all works.
Feel free to reach out to me here or on twitter if you have any questions or enhancements.
Ok I figured it out. The "install" directory is actually restricted access but for some reason the Visual Studio signing process leaves the app with enough permissions to access this folder. The correct procedure of determining a relative directory is not to use "Directory.GetCurrentDirectory()" but rather to use "ApplicationData.Current.LocalFolder". Hope this helps!

Categories