Database Connection: Visual Studio 2010 and Microsoft Access 2007(OleDbException was unhandled) - c#

I am new in creating application using Visual Studio 2010 and Microsoft Access 2007. I tried connecting Visual Studio with MySQL as a database and it worked fine but when I changed it to MS Access I got errors stating that OleDbException was unhandled and could not find the file. The database file I created is in the same folder where the program is located
This is the printscreen of the error:

The exception is telling you what the problem is: "The workgroup information file is missing or opened exclusively by another user".
Microsoft has a full explanation and solution here.

My understanding is that you need to set your Build Settings to target x86 cpu for the JET.OleDb Provider to work. If you are targeting "ANy CPU" or x64, you will run into an exception.

Related

Debugging without Visual Studio, but source and pdb files available

The situation is as follows:
I have a Windows 10 Machine with Visual Studio 2019, and created a c# .NET project in debug mode there and it Works.
The program happens to throw an unhandled exception with a meaningless/ambiguous message on a different Windows 7 machine. On that machine, Visual Studio 2008 happens to be installed. I get asked whether to use it for debugging, and I'd love to do so, to get the code which caused the exception. After copying over all the source files onto the Windows 7 machine I find that I cannot load the project using Visual Studio 2008, since VS 2008 refuses to load project files created with newer versions of Visual Studio.
I do, however, get an offer to use the Visual Studio 2008 debugger upon the crash, but if I use it, all I get is rather useless assembler code and a meaningless crash location address, since the debugger is not connected to the source code, and Visual Studio is not, AFAIK, capable to link that address to the source code. So the situation is, that I have all the source and symbol files available on the target machine, but the debugger does not load them, I don't know whether I can somehow show them to the debugger outside Visual Studio, and starting the project from Visual Studio 2008 is not possible because it won't load the project source files.
Is there any way I get a meaningful debugging, I mean with all the files in place it should be possible to debug with source display, even if the Visual Studio versions don't match.
Framework version is 4.x (most recent, think is 4.7). The message says that a service hasn't been started or is missing on the W7 machine, unfortunately no hint which of the 1000 possible services is meant. If I load the VS 2008 debugger, I get the fairly useless hint that the crash happened at address $..... (very, very long hex address). If I knew which part of the program caused the exception I could find out with ease. The question isn't targetet to to resolve the exception, but solely how to use the debugger to find out where the exception comes from, under the described circumstances.
You can use tools like dnSpy and my Runtime Flow for light weight debugging to find which part of the program caused the exception.
Is there any way I get a meaningful debugging, I mean with all the
files in place it should be possible to debug with source display,
even if the Visual Studio versions don't match.
I think you could use Remote Debugger just as Pavel said. It will use the local VS2019 to debug the source files on the remote computer without VS2008.
First, you should install the remote tool or just copy the Remote Debugger folder into the remote computer and then config as this document said, run it as Administrator on the remote computer.
Then, use IIS to run your asp net source files(you have the whole project source files and output files) on the remote computer
And on your local computer, open VS2019, use Attach to Process to catch the process of your project from the remote machine.
More info you can see this official document about it.
Besides, you can also use Debugging Tools for Windows-----WinDbg.

How can I enable live error checking in Visual Studio Community for Mac?

I'm using a fresh install of Visual Studio Community 2017 for Mac, but can't seem to get errors to display in the errors pad without running my program; on my Windows PC, design-time error checking with VS is automatic. I just updated to Mojave, but was having this issue in my previous Mac operating system.
To be clear, typing incorrect code in a simple console app file (or in a Unity project file, or in a number of other sample solutions that I tried), like string name = 23.45;, does not cause an error to be logged in the errors pad unless I run the program.
Is it possible to enable live error checking on VS for Mac, or does this feature only exist on Windows?

Unrecognized database format accdb in visual studio

I am using visual studio community 2017
Access 2010 - 2016
I can import an access file I created
File sent from client contains(tables, queries, forms, macros, and modules)
Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\jeremiah\Documents\Batching.accdb
The client sent me another basic file, was able to open without a problem
So I been through all current StackOverFlow solutions for people reporting the unrecognized database error and none of them have been useful.
My only theory is that the database they are using is to complicated to be used as a data source for visual studio.Do you have any suggestions?
I may not tell you what the problem is but I solved this issue before by resaving the database file as Microsoft Access 2003. Goto Save Database As Access 2002-2003 (*.mdb) and then use the new file.
You need use ACE.OLEDB 32 bits in Visual studio connection. (click in Advanced... button in Add Conection screen)
The visual studio try use of Jet.OleDB not more supported.

Error while browsing deployed projects in iis

Using Visual studio 2013 , ASP.NET
i tried deploying in my local PC and browsing it. It works perfectly!
But when i tried to browse the deployed program on the server PC,
The same program with same settings, it gave me this error (in the form of a messagebox).
Visual studio Just-In-Time-Debugger
An unhandled Win32 exception occurred in w3wp.exe[4992].
Possible Debuggers:
New instance of Microsoft Visual Studio 2010
i tried everything i can think of. Thanks in advance.

The "SetOffice2007AddInRegistration" task failed unexpectedly

I have created a new C# project using a Word 2013 and 2016 VSTO Add-in template in Visual Studio 2015. I have not done any changes to the auto-generated project code in order to see how it will be built on my TFS 2015 Build Server. The build produced the following error:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets (315, 0)
The "SetOffice2007AddInRegistration" task failed unexpectedly.
System.Runtime.InteropServices.COMException (0x800703F0): An attempt was made to reference a token that does not exist. (Exception from HRESULT: 0x800703F0)
at Microsoft.VisualStudio.Tools.Office.Runtime.Interop.VSTOEENativeMethods.GetVSTOEEHandle()
at Microsoft.VisualStudio.Tools.Office.Runtime.Interop.VSTOEENativeMethods.GetSolutionMetadata(String solutionInfoString)
at Microsoft.VisualStudio.Tools.Applications.OfficeSolutionMetadata..ctor(String manifestLocation)
at Microsoft.VisualStudio.Tools.Office.Runtime.AddInRegistryKeyManager.RegisterAddIn(Uri manifestUri, String addInName, String officeApplication, String friendlyName, String description, Int32 loadBehavior, String compatibleFrameworkXML, Boolean runLocal)
at Microsoft.VisualStudio.Tools.Office.BuildTasks.SetOffice2007AddInRegistration.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()
The Build Service is run as a domain account which is an administrator of the Windows Server 2012 where the Build Service is installed. The Visual Studio 2015 and Office 2016 are installed on this Windows Server.
When I build the project in Visual Studio 2015 on my local pc I have no errors at all.
Please, help if you experienced the same problem in your work. Thank you.
This issue is not TFS related.
But I found a solution from Jens at this website, which should help you:
"
According to the MSDN Library SetOffice2007AddInRegistration "Defines an MSBuild task that creates or removes registry keys that are needed to run or uninstall an add-in for the 2007 Microsoft Office system." So I checked the registry and figured out that the only entries that were still present were the ones under HKEY_CURRENT_USER\Software\Microsoft\VSTO\SolutionMetadata where VSTO caches metadata for solutions. I deleted all keys and subkeys (your existing solutions will still work, it's just cached metadata) and my solution compiled successfully.
"
As I have spent significant chunk of my time trying to resolve this error and getting to nowhere, I would like to share my experience with other people. I have a suspicion that MSBuild has a bug when it is run for XAML build definitions of Office Addin projects.
I created a brand new Word 2016 Addin project in Visual Studio 2015. No custom code. The project had only auto generated code. The Visual Studio built the project with no errors. I run the build with the MSBuild Diagnostic output Verbosity option selected.
After that, I run the MSBuild program from the command line with the same parameters that TFS Build Server run the build. The only difference was the the Diagnostic verbosity log option to create a detailed log. I compared two logs produced by Visual Studio and MSBuild. The MSBuild log indicated that workflow never got to the step of unregistering the Addin. Actually, it tried to register the Addin without unregistering. The Visual Studio log showed that the Visual Studio build unregistered the Addin and registered it after that successfully.
Learning the TFS 2015 features, I found out about Agent Pool and Build Agents. I realized that instead of running MSBuild for XAML defined builds, the TFS 2015 Build Agents use Visual Studio to build the application. So, I set up the Agent Pool and Build agent on my build server and, voila, the Addin was built successfully!
The conclusion is if you have XAML defined build for your Addin project, do not use it in TFS 2015. Create a new TFS build definition using Agent Pool features provided in TFS 2015. This will guarantee that your build will be done on TFS build server exactly like on your PC in Visual Studio environment.

Categories