Click to See Complete Forum and Search --> : Connecting to SQL Server Express DB on PC
Trav2003
06-28-2007, 12:11 AM
I've installed VS2005 and SQL Server Express w/Management Studio...
I've got all default SQL Server settings, I created my database, and I can connect to it via Management Studio.
Problem is I can't get Visual Studio 2005 to connect correctly.
Its set to use existing security (which is my local logon) and I checked permissions and only one (connect SQL) is granted to that username...
What do I need to do (I'm assuming its a fairly straight forward setup) to get visual studio to recognize and connect with my local SQL Express Server.
hu flung dung
06-28-2007, 12:29 AM
I had a similar problem just recently. Are you trying to get a website / web service hosted through IIS to connect to your database? If that's so, then you need to create an account named ASPNET in the sql server management studio. That's the account ASP.NET uses to connect to SQL server databases, but isn't set up by default in SQL Server.
Hope this helps.
Trav2003
06-28-2007, 12:37 AM
I had a similar problem just recently. Are you trying to get a website / web service hosted through IIS to connect to your database? If that's so, then you need to create an account named ASPNET in the sql server management studio. That's the account ASP.NET uses to connect to SQL server databases, but isn't set up by default in SQL Server.
Hope this helps.
Yes, its a website hosted on IIS (well IIS isn't installed, so it's using the Casini web server installed with VS2005)...
I will give that a try, but quick question:
At work we don't use the ASPNet account (we have a seperate account) to connect.
Is there a way to do it setting up whatever account you want. This will be hosted on a GoDaddy windows hosting site - so I'd prefer to keep the account login information the same for consistency sake.
Basically, I'm curious what rights need to be in order to correctly connect.
Also, when I go to properties on the original database and then to permissions, no accounts are listed. When I go to add, the only ones it shows to add are "Public" and "Guest" where is my user logon?
hu flung dung
06-28-2007, 12:53 AM
Hmm... I don't have what I need on my home computer to check this, but if I remember correctly, you don't create accounts on individual databases. You create accounts in SQL Server, then for each database select which accounts can access it.
In your case, it might be a better idea not to do Windows authentication, but rather SQL Server authentication and pass the account's user id & password in the connection string. This will make it easier should you ever want to move the database to a different server than your website.
ksuohio
06-28-2007, 09:40 AM
You need to create a login in SQL Server and then under User Mappings assign the user to the database you want to connect with. You will then have to assign a database role to that user besides public or give individual rights on the object in the database.
In your ASP.Net application, you need to setup your connection string to login using the SQL login:
Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;Uid=myUse rname;Pwd=myPassword;
Trav2003
06-29-2007, 01:09 AM
You need to create a login in SQL Server and then under User Mappings assign the user to the database you want to connect with. You will then have to assign a database role to that user besides public or give individual rights on the object in the database.
In your ASP.Net application, you need to setup your connection string to login using the SQL login:
Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;Uid=myUse rname;Pwd=myPassword;
Thanks guys - I'm connected and that aspect is working well...
But i've got another problem. When I set a breakpoint and debug the project, it just skips over the break point as if I weren't debugging at all.
All settings are default, only problem I could think that may be an issue is that I moved the project to a different folder than the default, and I did notice the MSBuild options show it as a different folder - but does that really matter?
ksuohio
06-29-2007, 08:00 AM
You will need to make sure that the project is in debug mode. Look in the web.config file.