sqlserver does not exsist or access is denied
:ehh: My computer is telling me lies is it :ehh:
i have this in the webconfig
VB Code:
<appSettings>
<add key = "oSQLConn"
value="server=localhost;database=StoreProc;integrated security=SSPI"/>
</appSettings>
this in my code behind
VB Code:
Public Sub getuser()
oSQLConn1 = New SqlConnection(ConfigurationSettings.AppSettings("oSQLConn"))
strSql = "EXECUTE sprShowUsers"
objCmd = New SqlCommand(strSql, oSQLConn1)
'Try
oSQLConn1.Open()
dataReader = objCmd.ExecuteReader()
'bind to datagrid
dgUsers.DataSource = dataReader
dgUsers.DataBind()
'Catch ex As Exception
'Finally
oSQLConn1.Close()
'oSQLConn.Dispose()
' End Try
this is my stored procedure
Code:
CREATE PROCEDURE sprShowUsers
as
select towm
from tbUser
order by carreg
GO
im trying to fill a datagrid and learn how to use stored procedures
i have got my users for asp.net and isur in my database also
cant figure out the problem:sick:
thanks
Re: sqlserver does not exsist or access is denied
Well its something wrong with your connection string or your SQL server. You sure the server is running? You sure you have access? What about database usernames / passwords in your connection string?
Try this connection string:
"data source=COMPUTERNAME;initial catalog=StoreProc;integrated security=SSPI"
Re: sqlserver does not exsist or access is denied
That style of connection string is using Windows Authentication. But I bet the IISUSER under whose context the webserver is running doesn't have access to the Server/Database. Either you need to add the IIS User to the list of logins and grant permissions to the database, or you need to modify the connection string to connect using a SQL Login/Password.
-tg
Re: sqlserver does not exsist or access is denied
if i state my connection as this
oSQLConn1.ConnectionString = "Data Source=(local);" & _
"Initial Catalog=StoreProc;" & _
"Integrated Security=SSPI"
it works a treat,
when i get iut setup corrrectly through the webconfig ill let you know