Last post Jun 05, 2012 04:18 PM by xbaldxaaronx
Jun 05, 2012 03:19 PM|xbaldxaaronx|LINK
I'm new to asp.net and managed to get a web page setup on my workstation that pulls info from a SQL database to display in Gridview.
However; I've had some trouble getting that working on a server. Whenever I browse to a page that uses DB info, I get an error.
I have an ODBC connection setup on the server. The database is also hosted on the same server.
What am I missing?
Jun 05, 2012 03:24 PM|Mikesdotnetting|LINK
The user account you are using to connect to SQL Server does not have permission to connect.
As an aside, you should not be using ODBC with SQL Server. It was deprecated 10 or more years ago. You should be using SqlClient: http://www.connectionstrings.com/sql-server-2008#p1
Jun 05, 2012 03:47 PM|xbaldxaaronx|LINK
Thanks for the reply.
I'm logged on the server as administrator so it seems like I should have permission.
Here's what I'm using now
<add name="ConnectionString1" connectionString="server=.\SQLEXPRESS;Database=ResourceUtilization;Integrated Security=SSPI;" providerName="System.Data.SqlClient"/>
but I'm getting
Jun 05, 2012 03:53 PM|xbaldxaaronx|LINK
by the way, i checked and remote connections are enabled. I know the database is working since I have Powershell scripts that are writing data to the tables.
Jun 05, 2012 04:16 PM|Bimalvv|LINK
Try to modify the connection string like this
<add name="ConnectionString1" connectionString="Data Source=.\SQLEXPRESS;Initial Catalog=ResourceUtilization;Integrated Security=SSPI;" providerName="System.Data.SqlClient"/>
Jun 05, 2012 04:18 PM|xbaldxaaronx|LINK
I ended up creating a user in the database and then used this string.
<add name="ConnectionString1" connectionString="server=.\SQLEXPRESS;Database=ResourceUtilization;User ID=UserName;Password=Password" providerName="System.Data.SqlClient"/>
After that, everything works fine.