数据库连接字符串打不开 !!
 连接字符串:workstation id=MIS05;packet size=4096;user id=share;data source=svrch07;
            persist security info=False;initial catalog=jinklang;password=share
 错误提示:
           SQL Server does not exist or access denied. 
 页面加载:
           
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim Con As New SqlConnection(Global.Com)
        Try
            Response.Write(Global.Com)
            If Con.State = ConnectionState.Open Then Con.Close()
            Con.Open()
            ' Response.End()
            Dim cmd As New SqlCommand("select [name] from login", Con)
            Dim red As SqlDataReader = cmd.ExecuteReader
            dlis.DataSource = red
            dlis.DataBind()
            red.Close()
            cmd.Dispose()
            Con.Close()
            Page.DataBind()
        Catch ex As Exception
            Response.Write(ex.Message)
        End Try
    End Sub

解决方案 »

  1.   

    已经排除SQL Server 中没有aspnet 的用户!!   
    先顶一下!!
      

  2.   

    data source=***;initial catalog=***;persist security info=False;user id=***;packet size=4096;pwd=***
    用这种格式试试
      

  3.   

    To  :focusonline(Study C#)  
     数据库连接字符还是打不开 !!
     
     错误提示:
               SQL Server does not exist or access denied.
      

  4.   

    1>建议你在查询分析器里键入sql测试一下,看看是否可以连通。
    2〉你是不是装了防火墙之类的把端口封了。
    3〉重启sql服务器
      

  5.   

    把sqlserver的验证模式改为混合模式试试,我以前就是这样.
      

  6.   

    先直接拖一个connection控件,再通过向导连接,查看连接字符串
      

  7.   

    怎么字符串那么复杂?我一直用server=***;uid=***;pwd=***;database=***的也可以连
      

  8.   

    Dim cn As New SqlConnection()
                cn.ConnectionString = "data source=192.168.1.165;initial catalog=gts ; persist security info=false; user id=newgts; password=howareyou_gts"试一下
      

  9.   

    看这个网站,绝对有帮助http://www.connectionstrings.com/
      

  10.   

    TO:   spgoal(敏捷的狗狗) ( ) 信誉:100 
          这个行不通,结果一样!!TO : aokon(傲空) ( ) 信誉:100     
          如何把sqlserver的验证模式改为混合模式 ??
    To: vitamin_ok(水水|Eddie) ( ) 信誉:97 
                这个也行不通,结果一样!! 
    再顶一下!!
      

  11.   

    你的sqlserver在本地吗,用datasource=(local)试试
    user=sa;pwd=***
      

  12.   

    TO: 回复人: yanyzty(yyz) ( ) 信誉:100 
                 不再本地了!!跟这个也有关系?
      

  13.   

    我觉得还是用户user id=share的问题,它有足够的权限吗,密码对吗
    你可以修改sqlserver数据库注册信息用user id=share登陆一下
    看看
      

  14.   

    不是本地的就用这个
    sqlstr="server=192.168.0.1;Database=****;user id=sa;password=45"
    如果还是打不开,那么你先在你的机子上ping一下那个sqlserver所在的机子通吗?
      

  15.   

    不是本地就用
    sqlstr="server=192.168.0.1;Database=dfssdf;user id=sa;password=12345678"
    如果还是报错,那么你现在你的机子ping 一下sql server那个机子通吗?
      

  16.   

    用这个server=127.0.0.1;uid=sa;pwd=***;Initial Catalog=***;这样即可,别的别写先
      

  17.   

    to  :   mazekui(悠悠春竹) ( ) 信誉:100 
            conationego(路之信) ( ) 信誉:100 
    方法:
            ping sql server那个机子,一切正常!! 
            server=127.0.0.1;uid=sa;pwd=***;Initial Catalog=***;
    结果:如题!!   我真得快疯了!!
      

  18.   

    up  的有分  !!
    up  的有分  !!
    up  的有分  !!
    up  的有分  !!
    up  的有分  !!
      

  19.   

    SQL Server does not exist or access denied. 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: SQL Server does not exist or access denied.Source Error: 
    Line 33: 
    Line 34:         If Con.State = ConnectionState.Open Then Con.Close()
    Line 35:         Con.Open()      '错误发生行
    Line 36:         ' Response.End()
    Line 37:         Dim cmd As New SqlCommand("select [name] from login", Con)
     Source File: C:\Inetpub\wwwroot\test\Suppliers.aspx.vb    Line: 35 Stack Trace: 
    [SqlException: SQL Server does not exist or access denied.]
       System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +484
       System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372
       System.Data.SqlClient.SqlConnection.Open() +384
       test.Suppliers.Page_Load(Object sender, EventArgs e) in C:\Inetpub\wwwroot\test\Suppliers.aspx.vb:35
       System.Web.UI.Control.OnLoad(EventArgs e) +67
       System.Web.UI.Control.LoadRecursive() +35
       System.Web.UI.Page.ProcessRequestMain() +731  什么意思,该怎么解决?
      

  20.   

    给个绝对可以解决问题的方法:
    先建立一个文本文件,然后将后缀*.txt改为*.udl,双击该文件,一步一步选择你的数据链接选项,测试成功以后,用记事本打开这个文件,里面的第二行起就是绝对可以用的链接字符串
      

  21.   

    1>建议你在查询分析器里键入sql测试一下,看看是否可以连通。
    2〉你是不是装了防火墙之类的把端口封了。
    3〉重启sql服务器