Results 1 to 4 of 4

Thread: sqlserver does not exsist or access is denied

  1. #1

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    sqlserver does not exsist or access is denied

    My computer is telling me lies is it

    i have this in the webconfig

    VB Code:
    1. <appSettings>
    2.     <add key = "oSQLConn"
    3.     value="server=localhost;database=StoreProc;integrated security=SSPI"/>
    4.     </appSettings>

    this in my code behind

    VB Code:
    1. Public Sub getuser()
    2.    
    3.         oSQLConn1 = New SqlConnection(ConfigurationSettings.AppSettings("oSQLConn"))
    4.  
    5.         strSql = "EXECUTE sprShowUsers"
    6.         objCmd = New SqlCommand(strSql, oSQLConn1)
    7.         'Try
    8.         oSQLConn1.Open()
    9.         dataReader = objCmd.ExecuteReader()
    10.         'bind to datagrid
    11.         dgUsers.DataSource = dataReader
    12.         dgUsers.DataBind()
    13.  
    14.         'Catch ex As Exception
    15.         'Finally
    16.         oSQLConn1.Close()
    17.         'oSQLConn.Dispose()
    18.         '   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
    thanks
    it works 60% of the time, all the time.

  2. #2
    Addicted Member
    Join Date
    Aug 2004
    Location
    Cape Town, South Africa
    Posts
    149

    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"

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4

    Thread Starter
    Fanatic Member d2005's Avatar
    Join Date
    Aug 2005
    Location
    ireland
    Posts
    620

    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
    it works 60% of the time, all the time.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width