数据库连接字符串打不开 !!
连接字符串: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
连接字符串: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
解决方案 »
- asp.net 附件下载问题
- jquery ajax如何返回dataset
- asp.net 生成静态页
- 为什么关闭子窗口后,网页正在打开。。。
- SqlDataSource动态设置问题,寻求帮助!(急,在线等!)
- 2005.net中的treeview为什么只有TreeView1_SelectedNodeChanged事件
- 如何在使用utf-8(requestEncoding,responseEncoding都为utf-8)时候让全球的多种语言正常显示,谢谢
- javascript代码问题!!
- qx_2000(Knight)请来讨论一下关于收发短信的问题
- 如何按名称引用一个控件?
- 关于checkbox插入XML的问题,急!!会的朋友来看看!!
- 类型转换求助
先顶一下!!
用这种格式试试
数据库连接字符还是打不开 !!
错误提示:
SQL Server does not exist or access denied.
2〉你是不是装了防火墙之类的把端口封了。
3〉重启sql服务器
cn.ConnectionString = "data source=192.168.1.165;initial catalog=gts ; persist security info=false; user id=newgts; password=howareyou_gts"试一下
这个行不通,结果一样!!TO : aokon(傲空) ( ) 信誉:100
如何把sqlserver的验证模式改为混合模式 ??
To: vitamin_ok(水水|Eddie) ( ) 信誉:97
这个也行不通,结果一样!!
再顶一下!!
user=sa;pwd=***
不再本地了!!跟这个也有关系?
你可以修改sqlserver数据库注册信息用user id=share登陆一下
看看
sqlstr="server=192.168.0.1;Database=****;user id=sa;password=45"
如果还是打不开,那么你先在你的机子上ping一下那个sqlserver所在的机子通吗?
sqlstr="server=192.168.0.1;Database=dfssdf;user id=sa;password=12345678"
如果还是报错,那么你现在你的机子ping 一下sql server那个机子通吗?
conationego(路之信) ( ) 信誉:100
方法:
ping sql server那个机子,一切正常!!
server=127.0.0.1;uid=sa;pwd=***;Initial Catalog=***;
结果:如题!! 我真得快疯了!!
up 的有分 !!
up 的有分 !!
up 的有分 !!
up 的有分 !!
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 什么意思,该怎么解决?
先建立一个文本文件,然后将后缀*.txt改为*.udl,双击该文件,一步一步选择你的数据链接选项,测试成功以后,用记事本打开这个文件,里面的第二行起就是绝对可以用的链接字符串
2〉你是不是装了防火墙之类的把端口封了。
3〉重启sql服务器