Could not load file or assembly microsoft.sqlserver.management.sdk.sfc - asp.net

Receiving below error message in Visual Studio 2008 while creating a connection for database.
could not load file or assembly
'microsoft.sqlserver.management.sdk.sfc ,Version=10.0.0.0,
Culture=neutral,PublicKeyToken=89845dcd8080cc91' or one of its dependencies.
The system cannot find the file specified.
I am trying to create database internally i.e. .mdf file and store it in the App_data folder.
But I'm not able to create the connection.
Please help me to sort out the issue quickly.

You can download these files from Microsoft website.
1.Microsoft SQL Server System CLR Types
2.Microsoft SQL Server 2008 Management Objects
3.Microsoft SQL Server 2008 Native Client.
After installing the above three files try to connect your application with sql server database and if still you got the same error message then don't worry and close your application then start it again and you will be able to connect it.

Related

Problem publishing ASP.NET application with a SQL Server database

I've created an ASP.NET website which runs perfectly from Visual Studio. It connects to a SQL Server .mdf database file in the App_Data folder. I published the project using FTP. The live website cannot however connect to the database, as it is LocalDB, and my host uses a SQL Server (SqlException (0x80131904))
I uploaded an identical copy of the local .mdf database file from my computer to the host's SQL Server. I then tried to form a data connection with the server database from Visual Studio, however my host doesn't allow remote database access, for security reasons, resulting in error 40.
I'm using ASP.NET MVC in my application so I need access to the database to create models. My host has said "you can access SQL Server databases using ASP scripts running on your presence".
So my question is: how do I create models based on my host's SQL Server database when remote access isn't allowed?
When you're testing with Visual Studio, you should connect to the local copy of your database. When you're ready to publish your application, copy the database to the remote sql server and attach it. The copy of your application which is published should then connect to the uploaded database on that server.
That way you have one environment for testing and one for real use. There shouldn't be any need for Visual Studio to connect to the remote database.
P.S. To allow you to connect to different databases in different environments, usually you set your database connection string in the web.config file. So if you create different config transforms for each build configuration (e.g. debug and release) then visual studio will create the correct version of the config file when you do a Publish operation. See https://learn.microsoft.com/en-us/aspnet/web-forms/overview/deployment/visual-studio-web-deployment/web-config-transformations for info about configuration transforms.

Establishing connection to SQL Server Error

I opened my web project today and for some reason I could not gain access to my database files. I get the following exception whenever I try to add, edit or refresh my database:
A network related instance specific error occurred while establishing
a connection to SQL Server. The Server was not found or is was not
accessible. Verify that the instance name is correct and that SQL
Server is configured to allow remote connections.
I took a look at my connection string for any spelling errors and deleted my database and replaced it in the folder I had it in. I can't seem to find a fix for this so any help would be a appreciated. I am using Visual studio 2008 for this web project.
This sounds like the same problem that I had myself awhile back. My problem was that my SQL service pack 1 did not install properly so I had to install Microsoft SQL Server System CLR Types, Microsoft SQL Server 2008 Management Objects and Microsoft SQL Server 2008 Native Client. After that I could create new SQLdatasources but I could not edit the ones I had previously before my problem. I had to restart my computer in safe mode and delete my SQLEXPRESS folder then recreate the database connection in visual studios. When I finished that everything worked fine.
This is the site I got those downloads, http://blogs.cametoofar.com/post/cannot-load-file-or-assembly-microsoftsqlservermanagementsdksfc.aspx

Problems deploying ASP.NET 4 app to Web Server

I just created my first ASP.NET Version 4 app using Visual Studio 2010 and SQL Express 2008.
I copied the files to IIS and run the default.asp. This loads the programs main menu. So far so good.
When I open the read webform and do a read of my database I get the following Error:
Server Error in '/Diary' Application.
Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.
Any idea how to fix this error?
Did you look at support articile for the very issue.
Or even this

How to include database schema and data in setup and deployment of asp.net web application?

I am trying to deploy my web application created with asp.net in visual studio 2010. I have successfully created .exe and .msi file, install it and run using IIS Manager. However, it needs a database which is why it is returning
System.Data.SqlClient.SqlException: The SELECT permission was denied on the object 'TableName', database 'master', schema 'dbo'.
whenerver I try to run it on browser with localhost.
How do I include my database file in deployment so that when I install my application in another computer, the database will also be created?
It is not at all clear what exactly you mean by database file but if you are referring to an SQLLite or SQL Server CE database file all you have to do is go to properties and change the "Copy to Output Directory" property to "Copy if Newer" (don't forget to do the same with the required class libraries).
If you are referring to SQL Server, Oracle or some other RDBMS database than you can't just copy the file, you'd have to either use DDL to create the database or attach the database file using the SSMS.
EDIT: I did not pay attention to the exception you posted so the second part of my question is relevant. SQL Server database file cannot be just copied to another computer, the target computer must have the SQL Server installed and you must detach the file from your local SQL Server and attach it on the remote SQL Server using the SQL Server Management Studio.

SQL server won't open DB created by Visual Studio

I've built an ASP.Net site in Visual Studio, and created the DB inside it (the .mdf file is in the APP_data folder).
Now, when I want to deploy in the customer site, I think about maintaining the DB without open Visual Studio, and by using the SQL Server Express tools (back up etc.).
I've searched how to do this, and learned that I should attach the .mdf file to sql server.
I've tried to do this and failed!
The error is: Unable to open the physical file "< .mdf >". Operating system error 5: "5(failed to retrieve text for this error. Reason: 15105)". (Microsoft SQL Server, Error: 5120)
Google didn't helped me to solve the problem.
Now I have 2 options:
1. To give up and deploy the site in the current situation where the DB is an .mdf file and ASP.Net can connect to it by the SQL server express compact (in the proccess).
To extract all the data (I need to think how...) and import it to new DB, this time in SQL Server DB.
Wat would you recommend doing?
Thank you in advance.
If on Windows Vista or higher, try opening SQL Server Management Studio by right clicking and saying "Run as Administrator". As Mitch mentioned maybe it is just a permissions issue. Then try attaching to the database.
Error 5 is usually permissions related. Do you have permissions to access the file in it's location?
If you've created it in Visual Studio, it's most likely an Express database. SQL Server does not support "user mode" database connections which SQL Server Express use. Despite sharing a name, they are two fairly distinctive and different technologies.
To view the contents of an SQL Express database (ie- created in Visual Studio) I just use the Visual Studio server explorer.

Resources