I am trying to learn Asp.net MVC framework. I was looking at the video tutorial at the link below
http://www.asp.net/learn/mvc-videos/video-395.aspx
In this video the very first step is to add a new database to the example application.
I have visual studio installed on my development machine but the SqlServer Express is running on a different machine, so when I try and add a new database following the same steps as the video I get the following error
"Connections to SQL Server files(*.mdf) require SQL express 2005 to funciton properly. Please verify the installation of the component or download from the url"
I am assuming this is because Visual studio is looking for an instance of SQL express on my local machine and since it doesnt exist on the local machine,it errors out.
So how do i tell visual studio, to connect to a different machine and create the database there?
I am using Visual studio 2008 with .net 3.5 Sp1
Make sure that remote connections is enabled in your sql server express installation (http://www.linglom.com/2007/08/31/enable-remote-connection-to-sql-server-2005-express/). Then take a look at www.connectionstrings.com for the various ways to connect to the sql server as appropriate for your environment. Then configure the connectionstrings section in web.config and reference that configuration target when connecting to the db.
Alternatively you might try using LINQ to SQL which will streamline some of these tasks (still need to enable remote connections and get an appropriate connection string defined...LINQ to SQL wizard for the rest).
Open the Server Explorer and add a new Data connection. Same thing as adding a new .mdf. You can use it just the same.
create the database on the remote computer(edit: IIRC, you can also create it within visual studio when you add the connection)
ensure that it allow remote connections
add the connection in database explorer
I'm not sure what's happening in that video, but if you for instance are going to use linq2sql, visual studio will add the connectionstring to web.config when you drag the tables into the .dbml :)
What you'll have to do is attach the mdf to the database server you have running on your separate machine, and then open up your server explorer and navigate to that particular machine and select the database from there.
I am not going to see the video so I can't tell you what step to change. But it should be easy enough to write a connection string (or get it off the web) that connects to a database on the remote computer and not your PC.
I am so used to writing my own connection strings that I don't even know of any option in VS that automates this.
Instead of add a new database to a remote machine as you indicated on your local machine, you can try to create the database on the remote machine firstly, and then connect to that remote database within your visual studio.
Related
On my PC, I messed up the default installation of the SQL Server that comes with VS22.
I managed to install SQL Server manually again, but I have to write a database class library using EF Core.
For that I have a connection string as follows:
Data Source=(localdb)\\MSSQLLOCALDB;Initial Catalog=TestDB;Integrated Security=True
I've been told that EF will create the database as needed after the name given in the connection string.
This works fine on my new laptop on which I did not touch the SQL Server. On my PC it does not work though.
What do I have to do to get the "default" installation of the SQL Server?
You can install LocalDB through the Visual Studio Installer, as part of the Data Storage and Processing workload, the ASP.NET and web development workload, or as an individual component.
The steps in Visual Studio Installer are as follows:
First select Modity, then select SQL Server Express LocalDB in Installation details. Hope it helps you.
This is my first time using it, I come from a PHP/MYSQL background and a client is asking me to assist with his MSSQL database and he gave me a file which is the exported database, it doesn't have an extension though.
I downloaded and installed Microsoft SQL Server Management studio but I'm not sure what to do, the tutorials online seem to be able to connect to the local server, on my end when I browse for a Server name I can't find anything under "Local server".
If it helps, the client have informed me that his previous developer (the one who seems to have had a conflict with the client and left) was using the same application with the server type set to "Database engine" and the Authentication set to "Windows Authentication", that's all the information I have.
Please help. Thanks.
If you installed a default instance of SQL Server with Management Studio, use the server name "localhost". If you only installed SQL Server Management Studio, you will need to at least download SQL Express: http://www.microsoft.com/en-us/server-cloud/products/sql-server-editions/sql-server-express.aspx
Also, note that if you develop in the latest version of SQL Server, you will not be able to back up and restore to the client's database if the client uses an older version. You will need to ensure all changes are scripted or use dacpacs (which you probably won't use).
Dear StackOverflow readers i would like your kind attention towards my one of the problem:
I have a Visual Foxpro application, in which i am accessing a remote SQL Server's Stored Procedure. Everything is working fine when I am installing the SQL Express 2008 in my Client Machine along with the FoxPro Application.
But when I am not installing the SQL Server On client Machine along with the visual FroxPro Application then I am getting a error " SQL Connect Error", Cannot Make Connection.
Is their any way that i don't have to install the whole SQL Express on client machine and i can only install the required libraries.
Regards
ProgChd
You should not have to install SQL Express itself, but at least ensure that you have the ODBC / OleDB providers for SQL Express. These can use SQL-Server connection which are somewhat common to already be on the machine.
As for your connection string, are you connecting via the fully qualified \server\database hosting information?
Just for grins, you could go through the machine's
Control Panel
Administrative Tools
Data Sources ODBC
and try to manually create an ODBC connection to the SQLExpress server you are trying to do via your VFP application. If you can't connect through that, then neither will VFP. Take the VFP app out of the equation and just test for the connection.
I recently contacted a web host regarding support for external database access to a Microsoft SQL Server database included in a package they offer. They replied saying that it is only possible with an SSH-tunnel.
Is it possible to connect to a SQL Server database in Visual Studio using an SSH-tunnel? It is important for me to be able to access the database from my local machine (for debugging, generating LINQ classes, editing tables, etc).
Or, how should I go about working with their database?
Accessing a database via an SSH tunnel works exactly the same as accessing any other database.
So, if you set up an SSH tunnel from the SQL Server machine to localhost:some_port, it's just about using that URL in Visual Studio.
How can I use SQLServer (instead of SQL Express) as my database?
I'm trying to go thru the ContactManager tutorial, but I can't seem to get it to use SQLServer - when I pick SQLServer from the "Add New Item" dialog, I get an error telling me that SQL Express isn't installed.
I know I must be missing something basic...
Most tutorials on the ASP.NET site are written in such a way, that you don't have to buy any software to do them. They use Visual Studio Express and SQL Express in their examples.
However, You can still follow along with the tutorial. Just make a few adjustments. Go to the Server Explorer to create a Connection to your SQL Server, and create the database and tables.
Then when it comes to the step of creating the EntityDataModel, create a new connection to the database you just created.
Only SQL Express can attach your database at runtime. If you have a non express version of SQL Server you will need to create the SQL Server using SSMS. If you want the file to physically live in app_data then when asked where to put the database file and the ldf indicate the app_data folder. Once you have created it, it is easy enough to simply add it as an exsisting item, although it can't be checked into source safe without creating obvious issues. I hope this helps.
If you're using a full-fledged instance of SQL Server, you don't need to use the "Add New Item" dialog at all. Rather, connect to your SQL Server instance (via Visual Studio or SQL Server Management Studio), and create the new database there.