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.
Related
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.
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.
I have connected with the database successfully by using wizard in server explorer. but the data source is showing nothing. i have googled and search on msdn help. but not get help.
I want to add data source. but add new data source option is disabled for me.
I am using windows form application...
I want ask that am i doing right. could you please tell me how can i get rid of not showing thing.
PLEASE HELP!!!
The Server Explorer of Visual Studio 2010 and the Datasource of your application are completely different. Check the following links to see how you can connect your Windows Form Application with Sql-Server database:
Walkthrough: Connecting to Data in a SQL Server Express Database (Windows Forms)
Connecting to a Database with Visual Studio Tools
I installed SQL Server 2008 R2 and I already have Visual Studio 2010.
When I try to connect to the SQL Server there exists no server on my Add Connection while my database engine works properly.
Why is that so?
As far as I can tell, in Server Explorer, you need to click the "Connect to Database" toolbar icon (or right-click Data Connections and choose "Add Connection...").
From the Data source list, choose Microsoft SQL Server and then click Continue. The Add Connection dialog box displays so you can enter your server name (machinename\instancename). You can choose between Windows or SQL Server Authentication (depends on how you set it up, but Windows Authentication should work for a local installation).
Once you have entered a correct server name and credentials you'll get a list of databases to choose. Select one if you wish and click OK. That should get your server added to the list for Visual Studio 2010.
The issue is that is VS 2010, you need to type in your localhost instead of choosing the connection from the drop-down list. I hope this issue is resolved in the next releases.
I believe if from VB 2010 you go to Project >> Add New Item and choose the appropiate path for your server it should work.
You may also want to try Data >> Add New Data Source
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"