Creating a Windows forms app with database - visual-studio-2010

I am using 2010 ultimate and just build a simple windows forms application. Just added a database as well to the form. Pull the application file out of bin directory. Tried to run but got error as unable to attach database? Installed Microsoft SQL Server Compact 4.0 and got same error? What am i dong wrong?
Error:
An attempt to attach an auto-named database for file C;\Users\Admin\Desktop\Database1.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share

Use C:\Users\Admin\Desktop\Database1.mdf instead of C;\Users\Admin\Desktop\Database1.mdf

The reason i am getting a error is because i was trying to run the app file without the database in the same folder, in this case the desktop. I am currently trying to rectify this. I think i will go with a ado.net entity database online and forget integrating a local database with the desktop application. –

Related

Error: Registration of the app failed

While trying to deploy an app from Visual Studio, I'm getting an error. I have already set developer mode and also deleted the app package from the packages folder, but it still won't work.
Here's the error message:
Error : DEP0700 : Registration of the app failed. Deployment Register
operation with target volume C: on Package
App_1.0.0.2_x64__m0fsgersa29a0 from: (AppxManifest.xml) failed with
error 0x80070002. See http://go.microsoft.com/fwlink/?LinkId=235160
for help diagnosing app deployment issues. (0x80073cf9)
Do I need to set anything else?
I got this when attempting to debug a project from a shared folder.
Opening the project from a local folder first resolved the issue.
I know there is already an accepted answer, but I had a totally different problem with the same excact error message. When th app was running I took a look in the SQLite database with a program that I didn't close when I uninstalled the app and re-run it from Visual Studio. I think that Visual Studio couldn't overwrite the database as I was 'using' it.
Closed the program and voila the app run smoothly.
Hope this helpes anybody else as I was stuck for precious hours!
In Windows 10 there are two possible cause of this problem are as follows,
Previously installed app is locked and preventing VS to delete while deploying the application. Goto C:\Users\{you user}\AppData\Local\Packages and delete the folder of your application. Now rebuild and deploy your application.(this was the solution in Windows 8 devices as well)
If it is still not working, double check if you have removed the below entry from appxmanifest file. If you are targeting Desktop Name="Windows.Desktop" entry should be there in the file. If it is Phone, Name="Windows.Mobile" should be there in the TargetDeviceFamily. You can have both in the configuration but sometimes Microsoft will suggest to keep separate configuration when you submit the application for STARTS testing.
< Dependencies>
< TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
< /Dependencies>
Hope this help in figuring out the reason and solution for "Error : DEP0700 : Registration of the app failed" error.
Don’t worry, the solution is actually very simple.
Error: DEP0700: Registration of the app failed. An internal error occurred.
So you’ve started your Windows 8 app development journey. All things are going smooth until one day you hit this error when trying to run/debug your app. The error says “Error: DEP0700: Registration of the app failed. An internal error occurred with error 0x80073D05. See http://go.microsoft.com/fwlink/?LinkId=235160 for help diagnosing app deployment issues. (0x80073cf6)”
This is a very cryptic error and does not give you any info about what the problem actually is. The problem is that Visual Studio is not able to delete the application data in your local packages folder.
Don’t worry, the solution is actually very simple. On your Windows 8 machine, go to C:\Users\\AppData\Local\Packages\ folder. There you will find a folder that has your application’s Package Family Name in it – you just need to delete that folder. The issue is that while your app is in development, it might have a random GUID as its Package Family Name, so the folder will also have that random GUID as its name which makes it hard to know which folder belongs to your app. Again, that is easy to find as well. Right click your project in Visual Studio and click properties. The value you see in the “Package Family Name” field is the name you should look for in the folder. Simply delete it and build your solution again and it will run like a charm.
Read more details at http://paraswadehra.blogspot.com/2012/12/error-dep0700-registration-of-app.html
For me this was caused by being signed in with my Microsoft account in windows instead of the local user account. Logging in as a local user fixed this.
DEP0700: Registration of the app failed
For me the error DEP0700: Registration of the app failed, was raised because my Store App was installed from the actual Microsoft Store. I had to uninstall it and then I could debug my app smoothly.
I got this when I tried to run the project from a ReFS filesystem. Running from NTFS worked. My error code was 0x80073cfd.
I stumbled over the same issue today and after a few hours I found out, that the problem was because I moved the AppIcon files into a subfolder and forgot to adjust the references inside my package.appxmanifest. Unfortunatly the corresponding error message didn't point into this direction and all the above mentioned solutions didn't help for me, so hopefully this helps someone else!
In my case, I was opening one of the App files (Log Files). When deploying, Visual Studio attempts to remove all the files and packages (if uninstall is on in the properties). It was unable to remove the Log file as it was opened. When I closed all files, and tried again, it worked.
I ran into this error when testing some code in domain-bound and non-domain-bound scenarios (which requires me to have a domain account and a non-domain account on the same machine).
I found that I had to uninstall the application from the account I originally deployed it from before I could deploy it again on the other account.
My problem is that there is another Microsoft account in my computer that installed the app from Microsoft Store.
Nothing from the provided solution helped.
The only thing that solved my problem is to delete that account that I installed the app there.
SQLlite database might be opened. Just close the sqllite and try to deploy again.

creating roles in database project

I`m using database project in visual studio 2013(professional).
All other thing works great, but I`m facing the issue with create user command. even I have already created user for dbproj on server with all access. Even I have only import database in database project and try to build though it showing me error.
Below command showing me error.
"Create user [dbproj] for Login [dbproj]".
Please help me out...
Thanks in Advance.
If same command I write into the postDeploymentScript then it works in my case.

Unable to write to subfolder in website

I have a webservice that I need to be able to write some logs for. The service is installed in c:\inetpub\wwwroot\myservice. The log files should be written to c:\inetpub\wwwroot\myservice\logging.
When I try running it in debug mode in Visual Studio, log files are created successfully. When I publish the site and try it, log files are not created.
I have tried giving write access for the logging folder to: NETWORK Service, IUSR, IIS_IUSRS, DefaultAppPool, ASP .NET 4.0 Classic but it made no difference. I also added Everyone with Full Control, but it made no difference.
Any ideas why I cannot get write access to this folder????
I have no idea what caused the issue, but IIS had somehow got corrupted. It would no longer display pages either by using localhost or 127.0.0.1.
Removed and re-installed IIS, all working now.

Attached SQL Express DB is causing problems

I have been asked to create an MVC web application in VS 2010, and was instructed to use a SQL express database for my data. I am using EF Code-First for creating and managing my data. The database was created in VS2010, and is attached via "AttachDBFilename" in the web.config.
I have used SQL CE before with MVC with no problems, however the attached SQL Express DB is causing weird issues.
For one thing, when I try to deploy the app, it fails and tells me that it cannot copy the database.mdf because it is in use by another process. I have NOT opened the database in VS2010 nor SSMS. Of course the program code accesses it - is there some reason that connection would remain open? I am using boilerplate code from the scaffolding.
I should mention that I use a ProjectInitializer.cs to create the sample data. It runs at every launch for the moment, since I am testing quite a bit.
The other problem I have is that if I delete the database, it fails to recreate it. It says that my windows account does not have access to the (now non-existent) database that it is trying to create. I literally have to create a new database with new name, as anything that was created previously (with that DB name) fails.
I assume there is some sort of residual info being left somewhere that is out of synch, but I don't know what it is. I've closed all connections to the file in VS 2010, deleted the files, both any found via VS2010 and any physical files I see in the app_data directory.
Any help or suggestions would be appreciated.
Shut down the web server (Cassini, IIS, IIS Express) and try again. The file can remain locked if the web process is still referencing the file. In addition the loaded EF context will retain the db name. Ensure the visual studio browser isn't running in the tray still either.

VS2010 - SQL CRL Deploy error - Deploy error SQL04105: The model already has an element that has the same name

I have a SQL CLR project created in VS2010. It needs to run PreDeployScript.sql and PostDeployScript.sql. Both files exist in project. However, when trying to run the deploy, I get the following error messages:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.SqlClr.targets(96,5): Deploy error SQL04105: The model already has an element that has the same name dbo.PropertySetCollection.
This message is repeated for every single type we have. This leads me to believe that PreDeployScript.sql was not run.
Has anybody else run into this issue? Is there a workaround?
Make sure you have not changed the Solution name. If you have you will now be out of sync with the assembly name on the SQL Server. To fix this just drop all the stored procedures for the existing assembly, drop the assembly, then try the deploy again. A new assembly will be created on SQL Server with the Solution name that is in VS.
Try using the Sql Proviler to check if the PreDeploy.sql has run.
Also read this:
https://connect.microsoft.com/VisualStudio/feedback/details/539211/db-projects-with-same-object-names-cannot-be-used-as-database-reference-error-sql04105?wa=wsignin1.0
It is a bug in VS2010 SQL CLR deployment. It has do to with dropping / adding computed columns in pre/post deploy scripts. MS is working on a solution.

Resources