remote connection string from Webmatrix 3 to Microsoft SQL Server

757 views Asked by At

This seems like a really easy problem to solve, from what I can gather online, but I cannot get it to work for the life of me:

I am trying to help out my dad on his website. It is an ASP.NET based site using Microsoft SQL Server Management Server. The code was developed using Visual Studio, and is hosted with Microsoft's IIS, so, in essence, it is a completely Microsoft-based site.

So far, I've gotten a test site to essentially work on WebMatrix 3; however, I cannot figure out what I need to put into the connection strings in order to get WebMatrix's SQL system to connect to the production server.

I also tried to duplicate the databases by extracting the structure from the production databases and running the query on WebMatrix, but the program needed service pack 2 for MS SQL 2008, and that install is failing for reasons I don't know why.

Best case scenario is I connect to the production server's databases.

Currently, the connection strings have:

Data Source = (ComputerName)\SQLEXPRESS
Initial Catalog = (db)
Persist Security Info = true
User ID = (uid)
Password =  (password)
ProviderName= System.Data.SqlClient 

So, to clarify,

Web Matrix is installed on my desktop computer, and the website is the code itself. The production site is the website code installed and running on a server somewhere I don't know where, while the test site is a copy of the website loaded onto webmatrix.

There is one working copy of the database, and it is on the production server.

I am trying to construct a connection string within WebMatrix that will connect to the server, through the proper port, and login to the database there to retrieve the data necessary to construct the site so that I can edit the code and test it.

So my question, in particular, is how does one accomplish this when there does not seem to be a slot to indicate a port in the WebMatrix connection wizard?

2

There are 2 answers

1
GmG On

Webmatrix supplies a wizard to create a connection with a SQL Server. In the Databases workspace you must select Connections > New > Sql Server Connection an input your configuration data into the form.

Anyway the resulting connection string in the Web.config file should be like this:

<connectionStrings>
   <add connectionString="Server=(ComputerName)\SQLEXPRESS;Database=(db);Uid=(uid);Pwd=(password)"
         name="MailingLists" providerName="System.Data.SqlClient" />
</connectionStrings>
0
Chris On

OK, my apologies; I have figured out how this works.

In the connection wizard, you can treat the "Server" box as if it were the "Data Source" option specified in a regular connection string. Then, you can add a comma and the port at which the SQL Server is set to listen.

However, now I am dealing with the problem where the host machine is actively refusing my connection.