ASP.NET Error with Database - asp.net

I have been learning ASP.NET and building a little customer portal. I used the built in CreateUserWizard. I wanted to look inside the ASPNETDB.MDF file to see how it was storing the users and maybe add some rows of my own. I opened the file in SQL Server Management Studio and viewed the file. I closed it with out saving.
Now when I try to run the program I get this new error:
The database 'C:\PROJECTS\PORTAL\PORTAL\APP_DATA\ASPNETDB.MDF' cannot be opened because it is version 706. This server supports version 662 and earlier. A downgrade path is not supported.
So I assume opening the project in SQL Server it upgraded the version to 706, How can I either delete this database and create a new one or change the version of the database to an support version.
Thanks

The following blog entry will help you
http://conceptdev.blogspot.com/2009/04/mdf-cannot-be-opened-because-it-is.html

As soon as you attached it to SQL Server 2012, the database was upgraded to version 706. As the error message suggests, there is no way to downgrade the file back to version 662 (SQL Server 2008 R2).
You can run the script found in your Visual Studio folder -
[drive:]\%windir%\Microsoft.NET\Framework\version\asp_regsql.
It'll display a UI for you to select the server to install a new copy on. Here's a MSDN article about it.

Related

Why is no database shown in Visual Studio?

My SQL Server Object Explorer is not showing any databases:
I also get an error A network-related or instance-specific error occurred while establishing a connection to SQL Server. .... When I run the website, the error being shown is The system cannot find the file specified. Furthermore, SQL Server is missing from Services:
(It was installed together with Visual Studio and was never used separately)
Yesterday, everything worked like charm; I had multiple databases with tables and was able to access the data. Today, the same project can't even start, no db's either. What's wrong with Visual Studio here? Thanks
I've had the same problem before. Took me a while to figure it out. What you need to do is go here: https://www.microsoft.com/en-us/download/details.aspx?id=42299
In my case, i'm using SQL Server 2014 Management Studio. You must find the one that suits the version of SQL studio that you're using (2008, 2012, 2014).
Click the big download button and now, it is very important that you choose the proper version. Check:
Express 32BIT\SQLEXPR_x86_ENU.exe if you're running on a 32-bit PC, or
Express 64BIT\SQLEXPR_x64_ENU.exe if you're running on a 64-bit PC
It is very important that you install Express version.
Next, once you install that, you should be able to see the SQL Server (MSSQLSERVER) in your services.msc, along with few other SQL services installed.
Open Visual Studio 2015 and in SQL Server Object Explorer window right click on SQL Server and choose Add SQL Server... option. It should prompt you to connet to the server from SQL Server Management Studio.
If you kept everything by default during the installation, just type . (dot) for the Server name and click connect. Now it should load the database.
It turns out that Visual Studio does not come with MS SQL Server in the default installation. It is necessary to install SQL Server Data Tools from the MS website manually. VS custom installation also allows to do that, but you will need an installer. Just make sure to select SSDT in the custom installation components menu. Additionally, I also ran an update from VS itself that allowed me to install SQL Server 2008, 14, and 16. I am finally able to access DB in VS!

Entity Framework with My SQL inside asp.net mvc [duplicate]

This question already has answers here:
Using MySQL with Entity Framework [closed]
(10 answers)
Closed 8 years ago.
Iam developing an asp.net mvc web application, and I have a commercial system which i want to connect to its MySQL database. so i decide to use the entity framework inside an asp.net mvc web application.
but when i tired to create a new connection i can not find an option to connect to the MySQL server, as shown below:-
So is there an option to connect to MSQL server instead of SQL server?
Install MySQL Connector for .NET, restart your Visual Studio and try again.
UPDATE:
Sometimes installing the Connector is not enough for Visual Studio integration. see https://stackoverflow.com/a/4257203 for solution.
It better to user Nuget and install MySql.Data from there than install .NET connector. First of all use of connector will cause the situation that you need to install connector to your server environment. Also, if tomorrow you will install new version of connector locally you should reinstall it on server also (you cannot have 2 versions of connector to be installed on same machine, so web applications that user older version will stop working).
All you need to do it's use Nuget Packet manager, search for MySQL.Data and install it. Also (i dont remember its by default done) you should go to property of this reference in solution and set it to always copy locally. That's it, all should work.
[Update]
Also, to navigate in mysql is better to use native mysql tools, like MySQL Workbench. It has much more possebility
You may need to use the MySQL Installer for Windows:
http://dev.mysql.com/tech-resources/articles/mysql-installer-for-windows.html
I read somewhere that it's the only way to get VS support now.

MDF Cannot Connect from Visual Studio

I am getting this error and I have SQL Server 2012 installed anyone know what's wrong? I am trying to attach a database file into my Visual Studio 2010.
The database 'X' cannot be opened because it is version 661. This
server supports version 655 and earlier. A downgrade path is not
supported.
Could not open new database 'X'. CREATE DATABASE is aborted.
An attempt to attach an auto-named database for file X failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
The database file was created and/or attached on a SQL Server instance that was of a newer version than the one you have. If you bring your local instance up-to-date to a newer build, then you should be okay.
More specifically - version 661 is SQL Server 2008 R2. The instance you are attaching (651) to is SQL Server 2008 RTM or SP1. Be sure it is using SQL Server 2012 instance instead of perhaps a local SQL Express instance.
See here:
http://www.sqlskills.com/blogs/paul/sql-server-2008-r2-bumps-the-database-version/
Turns out the problem is with regard to an Express Edition. I cannot use the full version because the mdf file I'm binding requires user instance which is only supported by Express Editions. I downloaded the SQL 2012 Express from this https://www.microsoft.com/betaexperience/pd/SQLEXPWT/enus/default.aspx which allows for LocalDB and all the problems go away.

Unable to find the requested .Net Framework Data Provider. It may not be installed

We are getting this error when updating site on new server. We are using mysql with asp.net project in visual studio 2010.
Unable to find the requested .Net Framework Data Provider. It may not be installed
Thanks.
The MySql provider specified in your connection string is not installed on the server. Install it. It'll be whatever is installed on your development machine.
For a better answer, please post the part of your connection string that shows which provider/version to use.

Problem with aspnet_regsql.exe

i wrote a website with asp.net 4 and sql server 2008. But my host sql version is 2005 so i get script from my database in sqlserver 2008 and convert it to 2005. Then i import .sql file that is exported from 2008 iin sqlserver 2005 and retrieve it. Then i make a back up with sqlserver 2005 and upload it on my host. Now i have one problem:
I used aspnet_regsql.exe to create the database schema.
But when i want to login to my website it throws following error:
The 'System.Web.Security.SqlMembershipProvider' requires a database
schema compatible with schema version '1'. However, the current
database schema is not compatible with this version. You may need to
either install a compatible schema with aspnet_regsql.exe (available
in the framework installation directory), or upgrade the provider to a
newer version.
What is the problem?
Which version of ASP.NET is your published website using? It looks like it might be different than what you're using in development.
The version info is configured on a per-AppPool basis in IIS.

Resources