C# - OleDb Exception while running published .exe - c#

I'm working on a C# project. While running it in VS2013, it shows no error. I'm using MS Access 2010. But after publishing the project, clicking any button that involves database process, .exe application shows OleDbException.
OleDbException : Use updateable query.
But it works perfectly on VS2013.
My Connection String : Provider=Microsoft.Jet.OLEDB.4.0;Datasource=|DataDirectory|\\Resources\\GreenTrends.mdb;Persist Security Info=True
Thanks in advance!

Make sure that the user running the process has appropiate read/write permissions to the database file. The error message as such can be a bit misleading since its often missing permissions causing the error. For more information please refer to this SO answer

Related

Access to the path '/iPhoneSimulator/Debug/ibtool-manifests' is denied

I am developing an IOS mobile application. I am using Visual Studio 2019 for the development and use iPhoneSimulator to test the application, after connecting to the mac device. Suddenly I am getting an error as preceding.
MessagingRemoteException: An error occurred on client Build162090 while executing a reply for topic xvs/Build/16.2.0.90/execute-task/Sprint.SESAT.iOS/a303cd7002fIBTool
UnauthorizedAccessException: Access to the path '/iPhoneSimulator/Debug/ibtool-manifests' is denied.
IOException: Permission denied
Anyone ever faced this issue before, I am 100% sure that it is not related to any recent code changes, thus providing codes wouldn't help here.
I was actually sure about that this has nothing to do with my recent code changes, thus I did the preceding things first.
Clean the solution and rebuild
Delete the bin and obj folder manually and then rebuild
But I was getting the error again, the only thing which worked for me is restating the visual studio and open the project again. Hope it helps.

VS 2005 restarting when building project solution? How to resolve it?

I getting one issue in vs2005 website project solution. When I start build my vs2005 project in some time vs2005 shows error:- "Microsoft Visual studio has encountered a problem and needs to close".
every time restart visual studio when I started built solution.
How can I get rides from this error?
Any solution.
Error Message from Event Viewer:
for privacy I changed my project name with dummy
It showing message: Windows cannot access the file D:\MyProject\Bin\MyLib.pdb for one of the following reasons: there is a problem with the network connection, the disk that the file is stored on, or the storage drivers installed on this computer; or the disk is missing. Windows closed the program Microsoft Visual Studio 2005 because of this error.
Program: Microsoft Visual Studio 2005
File: D:\MyProject\Bin\MyLib.pdb
The error value is listed in the Additional Data section.
User Action
1. Open the file again. This situation might be a temporary problem that corrects itself when the program runs again.
2. If the file still cannot be accessed and
- It is on the network, your network administrator should verify that there is not a problem with the network and that the server can be contacted.
- It is on a removable disk, for example, a floppy disk or CD-ROM, verify that the disk is fully inserted into the computer.
3. Check and repair the file system by running CHKDSK. To run CHKDSK, click Start, click Run, type CMD, and then click OK. At the command prompt, type CHKDSK /F, and then press ENTER.
4. If the problem persists, restore the file from a backup copy.
5. Determine whether other files on the same disk can be opened. If not, the disk might be damaged. If it is a hard disk, contact your administrator or computer hardware vendor for further assistance.
Additional Data
Error value: C000009C
Disk type: 3
There was a problem due to the .pdb file.. It getting me issue.
When I Deleted and Re-Insert (D:\MyProject\Bin\MyLib.pdb) Class Library File(.pdb) into my Web Solution, then It worked.
I resolved Issued by delete and Re-Insert file from class library to the web application then Build/Re-Build Solution...
Its Resolved my Issue.
Thanks

wpf setup doesnt work in other computer

I have got setup project working with database and wpf on my machine, but when I try to install on other machine I can successfully install and run. When I try to run any function with datagrid just stops working but Can see is adding this to database, but on my machine with the setup runnig doesnt do that, displays without any problem. Havent got any idea of what can be.
pls helpppppp .
I think, that problem is in references: maybe on your development pc is installed some control which is used in your project. So when you try to run on other pc, where application can't find right dll in GAC, you get exception. Try to read exception carefully and you will find information about what is missing (some exception details can get to event log of pc).
EDIT
Other possibility is connection string in config file.

C# .net -> SQLite error: Unable to open the database file

I'm getting "System.Data.SQLite.SQLiteException: Unable to open the database file." when I attempt to access the database to save a record upon the "first" opening of my program.
Here's the thing, it works fine when debugging locally in Visual Studio, but stops working when I package the program in an installer, and then install the program somewhere.
I was guessing that it was the location of the database, which I just have set at database.s3db without a path, because it is stored next to the program's exe, but how could that cause problems?
I'm at a loss, any further ideas or suggestions for solving this problem would be greatly appreciated.
Maybe you are installing the program in a folder which the user doesn't have write permissions so cannot modify the database file.
Please update your DataSource Format like this :
#"C:\Users\Mehmeto\Documents\Visual Studio 2015\Projects\......\bin\myDB.sqlite";
Where the directory points to where your project is located.

Visual Studio 'Publish' command fails

I'm working on a moderately sized WebForms project. Due to the peculiarities of management here, I have to upload the site to a remote server in order to test (no localhost testing). I'm using the 'Publish' command in Visual Studio 2008. Sometimes, it even works. Most of the time, I inexplicably get a "publish failed" in the bottom left corner, with no further details.
The few googled articles/forum posts I read suggested making the target local folder for the publish operation readable/writable for everyone. Doesn't help.
Is there are way to get further details as to WHY a publish fails in VS2008, and if not, is there a better way of doing these deployments? I'm spending more time building/pushing to the web server than actually debugging.
It's worth checking the output window. I've just had a publish fail because I had deleted an image outside of VS so VS was complaining that the image couldn't be found, but this information was only displayed in the output window.
See this link for more information:
http://ericfickes.com/2009/08/find-out-why-visual-studios-publish-fails/
It happens to us when there is an error in markup (!). Bad thing is that VS will just swallow the error and just tell you Failed.
What I suggest is to run your publish from command line using MSBuild. It's not that straightforward but it works (once you get into it).
I've since discovered that the reason for these particular publish failures was due the "Delete Existing Files" option being checked. Using Visual Studio 2008 under a non-administrative account on Windows Vista could cause a permissions error while attempting to delete the existing files. The publish would fail silently after encountering a file that Visual Studio had insufficient access to delete. Once the files were deleted manually outside of Vidual Studio, the publish functioned normally.
I have not had this issue with Windows 7; I assume the UAC changes in Windows 7 fixed the problem.
I mostly work with Web Forms, and I encounter this problem daily.
It seems to me that publish fails when it fails to delete a file it is trying to replace. Even if I don't have any files open, it still fails sometimes. Not sure why.
Not only VS publish fails very often, it is painfully slow as well.
I just publish to empty local directory and use separate FTP client to upload files. It's more work, but works.
This is probably not the case for you, but I've seen this happen when I'm publishing a web site. If the app_offline.htm file is not excluded from your project (if you use this file), the publish will fail.
Same happened to me.. what I did was include images files that was not included in the project and delete images that were not used.
After struggling with a similar issue for about 30 mins with no clue as to what was causing it closed down VS and reopened my project. Started working fine. No idea why but it worked.
You should always stop the IIS instance running on the machine your are publishing to. Google the word "iisreset". Other hosting providers like DiscountAsp and Arvixe offer you tools to "Stop" and "Start" your app pool on their IIS remotely. This is very necessary because IIS may have locked some files as "in use", so your publish fails when it tries to write over them. When your publish is complete, then just restart IIS (or press "Start" from a web tool if you're using a 3rd party hosting provider).
When all else fails, check your "Output" window (the tab to the right of your "Error List" at the bottom of Visual Studio). Scroll through all of it after a failed publish and look for anything that says "Unable to add". If you keep seeing the same "Unable to add" errors on the same publish, then ftp into the folder, delete the the problematic files manually, and try publishing again.
I got this when my ProjectName.Publish.xml file was read-only. Once I checked the file out of source control, I no longer got the error and could publish.
Just to add to this thread, I found that, for some bizarre reason, only the Mercurial files were being published to the server, everything else just wasn't being copied across.
Another strange thing was that only the Debug configuration was available; Release was nowhere to be seen.
After reading other threads around S.O., I found that there were many for VS 2010 and 2012, but not much to cover the same problem with 2008.
The fix, I found, was to delete the [solution].suo file and then attempt a publish. That seemed to do the job, though it took a long time to complete.
What I found and work in my case. It is to use a different version of VS.
I recently had the problem, the solution works perfectly in VS2015 build, compile and tested.
However, when I try to publish was failing silently.
So, I closed the solution and open it with VS2017 that use the same file structure for the projects/solutions. Then rebuild it and publish without any problems.
I believe it could be VS related and it is complicated to debug.
This is a workaround if you work with multiple Vs instances in your local machine.

Categories