Cannot create Sql Server database in App_Data folder - visual-studio-2010

When I try to create an Sql Server Database in the App_Data folder of my Visual Studio 2010 project, I get the following error:
Login failed for user:[Domain]\[user]
I am able to create databases using Sql Server Management Studio. I am using Sql Server Express 2008.
Any help regarding this is appreciated. Thanks in advance!

As you are using express edition, in Visual Studio go to Tools>Options>Database Tools>Data Connections.
Remove the SQL Server Instance Name and click OK.
Now try connection to the server using Server Explorer. Once you get connected, you will be able to create a new DB in App_Data folder.
Here is the connection string:
public string ConStr = "Data Source=.;AttachDbFilename=|DataDirectory|CodeDB.mdf;
Integrated Security=True;User Instance=True";
Also make sure that you have user instances for your DB enabled.

In Visual Studio 2013:
Go to Tools-->> Options-->>Database Tools-->>Data Connections. SQL Server Instance Name
Type ProjectsV12
Then Create SQL Server Database inside the App_Folder, and it will work.
Open CommandPrompt as administrator
Type sqllocaldb info and press enter
It will display all the available local db.

Related

Visual Studio 2022 try to connect to sql server instead of connection history, Getting error "'CONNECTIONPROPERTY' is not a recognized

Getting error "'CONNECTIONPROPERTY' is not a recognized
This is the new problem I have in VS 2022 it works fine in VS 2019
The same, issue is happening with Visual Studio 2022. It works fine with VS 2019.
The connections/ login window looks like in SQL Server Management Studio.
Details: in Visual Studio on the SQL Server Object Explorer I was able to add the PDW server.
I can browse the server tables, stored procedures, security and all.
If I right-click on a database, or table and select "New Query", it will ask me to log in with the same window as M Studio.
I am able to connect fine if I open an existing query.DSQL file it allows me to use history connections or connect normally.
So I am connected to the server on SQL Server Object Explorer but when try to open a stored procedure it asks to login again and that is where it fails because it tries to connect with different parameters
I get this(https://i.stack.imgur.com/PYcFr.png)](https://i.stack.imgur.com/PYcFr.png)
instead of (https://i.stack.imgur.com/0beik.png)](https://i.stack.imgur.com/0beik.png)
when I add the server I am able to brose the databases table and so on when try to open query window
it ask you to connect when was already connected.
the error is related that it try to connect like management studio that does not allow connection to PDW.
then I do have a different window see the pictures

Cannot see Azure DB tables when using Visual Studio

I'm new to Azure and I'm trying to connect to our Azure DB using Visual Studio.
I can connect to the DB fine, but when I expand the DB I cannot see any DB Objects. See the image below. I've Googled the issue but cannot find where anyone has replicated this issue, so I accept I'm likely doing something wrong!
I can query the DB fine and it will return results.
To connect the visual studio to azure database and view the tables of database in visual studio follow the following steps:
Open your project in visual studio, Click on server explorer
Then click on SQL server Object explorer
Then click on Add SQL Server
Then expand Azure, click on your mail id and select subscription.
Then it will show all databases present in your subscription, select
your database I will fetch all information expect password, provide
your password and click on connect.
It will show all your databases tables from azure database
You can refer to this Document for more information: Work with Visual Studio to connect to SQL Databases in Azure.

This server version is not supported. Only servers up to Microsoft SQL Server 2012 are supported

I have SQL Server 2014, VS 2012 and VS 2013. Both VS are ultimate versions. I can not access SQL server from either VS.
Example:
Open VS. From Tools menu, select "Create Database". Enter SQL Server name, select a database (all the DBs are listed OK). Click on Test connection button. Connection is OK.
Now when I click the OK button, I get the following error.
Unable to add data connection. Could not load file or assembly 'Microsoft.SqlServer.Management.Sdk.Sfc, Version=11.0.0.0, Culture=neutral....... The system cannot find the file specified.
From VS, Server Explorer, right click on Data Connections, "Create a new SQL Server database". Enter Server name, enter new database name. Error message appears:
This server version is not supported. Only servers up to Microsoft SQL Server 2012 are supported.
I will appreciate if anyone can help.
Thank you, Saleem
Please try this once:
Go to Sql Sever Configuration Manager
Then SQL Server Network Configuration -->Protocols for SQL Server
Then Named pipes --> Rc Properties
Copy the Pipe Name.
then go to Visual Studio--> Server Explorer-->Data Connection-->Rc Add Connection
Then Paste the Copied Pipe Name in Server name
Test the Connection.
That's it. I hope it is helpful.

New database in SQL Server 2008 does not show up in dropdown

I'm new to using Visual Studio and SQL Server.
My problem is this:
I have created a database in SQL Server Management Studio, then I'd like to connect it my app in Visual Studio. I right click in the Server Explorer and click on Add connection. Here I can find through dropdown list my server, but when selecting the database under "Connect to a database" it doesn't find my new database in the dropdown list...
Can you help me please? Thank you a lot :-)
check whether it is windows authentication or server authentication in sql server 2008 where you have created the database. If it is server authentication then check whether you are entering correct username and password.

Cannot connect to Sql Server database: non-system databases are not shown

I'm trying to connect to SQL Server 2008 express database from Visual Studio 2010 using data connection wizard. I choose new connection -> MS Sql Server then I choose the only available server name (PAVEL-PC\SQLEXPRESS). The problem is i cannot see my database in the combobox below. System databases (like master, model, msdb etc) are shown though.
I've managed to find similar questions (like this one: Cannot connect to SQL Server database in Visual Studio because my database isn't there) and it seems I'm having permission issues. However I cannot understand which user (and where) should I add.
The account name which I'm running my Visual Studio on is Pavel. My computer name is Pavel-PC. I'm not sure what my SQL Servers account names are, but it was installed using default settings.
Here is the answer to my question:
use "PAVEL-PC" instead of "PAVEL-PC\SQLEXPRESS"

Resources