VS中连接SQL数据库失败的问题 5C

图片说明
在添加sql数据库连接是总会显示无法打开登陆所请求的数据库
但是在添加数据连接是测试成功的

如果通过服务器查找到的数据库连接是可以连接到的,但是最后调试结果还是无法打开所登陆的数据库。

但是在数据连接中直接添加数据库文件,会这样显示图片说明
这时候window日志显示为:LocalDB parent instance version is invalid: MSSQL13E.LOCALDB

8个回答

你要确保你的SQL配置管理器中的SQL服务是打开的

图片说明

qq_42315039
157Q 回复sinat_37644671: 可以正常登陆的,我重装之后在vs导入数据库文件的时候还是不对……日志大概是localDB的版本和sql的版本不匹配?
一年多之前 回复
sinat_37644671
sinat_37644671 数据库能正常登陆吗
一年多之前 回复
qq_42315039
157Q 回复qq_41099505: 感觉是我之前装了2012卸载的时候出了点问题……我去重装试一试
一年多之前 回复
qq_41099505
qq_41099505 回复qq_42315039: 这个问题我不太清楚。。。没碰到过
一年多之前 回复
qq_41099505
qq_41099505 回复qq_42317855: 可以啊,SQL Server本来就有两种登录方式,每次打开都需要选择window身份还是SQL身份登录,不过第一次登录都是用window,因为SQL身份在安装时是被禁止的,用window身份登录之后将其启用就可以了
一年多之前 回复
qq_42315039
157Q 回复qq_42317855: 允许了,刚刚查看了日志是无法打开文件号 1 的文件 d:\dbs\sh\sprel\0822_164025\cmd\33\obj\x64retail\sql\mkmastr\databases\mkmastr.proj\model.mdf,这样的话是要去新建一个吗?
一年多之前 回复
qq_42317855
qq_42317855 回复qq_42315039: 数据库安装的时候允许windows登录吗
一年多之前 回复
qq_42315039
157Q 刚刚去看了一下确实没启动……但是启动的时候提示说请求失败或服务未及时响应
一年多之前 回复

server=.修改为具体的服务器名称或者IP地址试一下.

weixin_42318789
weixin_42318789 server=.修改为具体的服务器名称或者IP地址试一下.
一年多之前 回复
qq_42315039
157Q 修改过了,问题应该是sql server服务没启动的问题,但是启动时也是请求失败或服务未及时响应
一年多之前 回复

实在不行就重装吧,虽然Server重装各种坑,实在实在不行就重装系统,先装.NET 2 3 4,接着是IIS,接着数据库,最后VS
另外代码我大致是这样写的

 private SqlConnection CreateMsSqlConnection()
{
    SqlConnection connMySql = new SqlConnection(strConnection);
    return connMySql;
}

//用到的时候
using (SqlConnection msSqlConnection = this.CreateMsSqlConnection())
{
    SqlCommand msCommand = new SqlCommand(strSql, msSqlConnection);
    SqlDataAdapter dataAdapter = new SqlDataAdapter(msCommand);
    msSqlConnection.Open();
    dataAdapter.Fill(dsAll);
    dataAdapter.Dispose();
    msCommand.Dispose();
}

using System.Data;
using System.Data.SqlClient;
//先打开两个类库文件
SqlConnection con = new SqlConnection();

// con.ConnectionString = "server=505-03;database=ttt;user=sa;pwd=123";
con.ConnectionString = "server=.;database=stu;uid=sa;pwd=sa";
con.Open();

/*
SqlDataAdapter 对象。 用于填充DataSet (数据集)。
SqlDataReader 对象。 从数据库中读取流..
后面要做增删改查还需要用到 DataSet 对象。
*/

SqlCommand com = new SqlCommand();
com.Connection = con;
com.CommandType = CommandType.Text;
com.CommandText = "SQL的语句";
SqlDataReader dr = com.ExecuteReader();//执行SQL语句
dr.Close();//关闭执行
con.Close();//关闭数据库

1、一种情况是在安装过程中选择“混合模式”,但是实际应用中sa的密码忘记了或是sa密码丢失时:

a、在SQL Server Management Studio 用Window连接的情况下改实列的“属性”中“安全性”选中WINDOWS及SQL验证,再重起SQL服务器后,新建查询,执行下面代码
ALTER LOGIN sa WITH PASSWORD='新密码'

b、在SQL Server Management Studio 用Window连接的情况下改实列的“属性”中“安全性”选中WINDOWS及SQL验证,在SQL服务器上点击安全性,即找到根节点->安全性->登录名->sa. 右键sa打开属性对话框。

1、在“常规”页中设置sa用户的密码,注意密码不能太简单,如密码是sa肯定是通过不了的。
2、在“用户映射”页中,确认一下SA用户有没有db_owner角色身份。必须要有,要不然sa登录后什么高级功能也做不了了。
3、在“状态”页中,把“是否允许连接到数据库引擎”设置为“授予”,把“登录”设置为“启用”。
4、点击确定保存配置。

2、一种情况是在安装过程中选择“Windows 身份验证模式”,则 sa 登录将被禁用:
在SQL Server Management Studio 用Window连接的情况下将身份验证模式更改为“SQL Server 和 Windows 身份验证模式”,则 sa 登录仍处于禁用状态。若要启用 sa 登录帐户,请使用 ALTER LOGIN 语句(如上a)。

sql服务器的ip/tcp选项启动

请使用下面的连接字符串。
"Data Source=localhost;Initial Catalog=SecondHandbook;User ID=sa;Password=sa;Persist Security Info=True;"
其中"Data Source=localhost"这里"localhost"指的是本地数据库,若数据库部署其他电脑则填写该电脑的IP地址。
而“User ID=sa;Password=sa;”是SQL数据库服务软件的登录账户名和密码(sa,sa),根据自己的配置填写就行。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
VS连接SQL数据库
VS连接SQL数据库(windows身份认证)时,web.config文件里的连接语句应该怎样写?求指教。
连接SQL数据库失败
服务器错误' / '应用程序。rnrn--------------------------------------------------------------------------------rnrn一个网络或特定实例发生错误,同时建立一个连接到服务器。服务器不存在或不可访问。验证实例名称是正确的,服务器配置为允许远程连接。(提供者:命名管道供应商,误差:40 -无法打开一个连接到服务器)rn描述:一个未处理的异常发生在执行当前请求。请检查堆栈跟踪信息有关该错误以及它起源于代码。rnrn异常详细信息:system.data.sqlclient.sqlexception:与网络有关的或特定实例发生错误,同时建立一个连接到服务器。服务器不存在或不可访问。验证实例名称是正确的,服务器配置为允许远程连接。(提供者:命名管道供应商,误差:40 -无法打开一个连接到服务器)rnrn源错误:rnrn一个未处理的异常是在执行当前请求。信息的起源和异常的位置可确定使用下面的异常堆栈跟踪。rnrn把项目发布到服务器上后,修改了webconfig里的数据库链接字符,还是有错
vs中,添加数据库失败
我使用使用 Visual Studio .NET 2003 ,在Server Explorer(服务器资源管理器)窗口中连接的数据库,可是点击“添加连接”,却没有任何反应,不知为什么,那位知道,谢谢。
vs连接sql问题
SqlConnection conn = new SqlConnection("server=YX-PC\SQL2005;uid=sa;pwd=123456;database=liandong;");rnrn错误提示: 无法识别的转义序列 请问如何解决这个 YX-PC\SQL2005
SQL与VS连接的问题
我的vs与SQL连接都很正常,就是在做项目的时候,发现在vs与sql连接插入数据只能插入英文字母和数字,我在vs里面写的SQL语句里面插入的汉字到了数据库全部都显示的是?????,返回的查询结果也是这样的啊,郁闷啊!!!!我直接在数据库里可以插入汉字的啊,应该是数据库的问题吧?那位高人指点以下啊?
VS中SQLCLR数据库项目部署失败问题
我的sqlserver是2008的rnrnrn我在VisualStudio2010 中创建了一个Visual C# Sql CLR 数据库项目rn=>创建了一个触发器 Trigger1.csrn=>在Trigger1.cs中 写了几行代码rn=>然后编译,编译成功如下:rn ------ 已启动生成: 项目: SqlServerProject1, 配置: Debug Any CPU ------rn SqlServerProject1 -> F:\DataBaseTest\TriggerTest\SqlServerProject1\bin\Debug\SqlServerProject1.dllrn rn=>编译成功后,部署失败rnrn----- 已启动部署: 项目: SqlServerProject1, 配置: Debug Any CPU ------rn生成启动时间为 2012/4/25 16:50:23。rnSqlClrDeploy:rn 开始将程序集 SqlServerProject1.dll 部署到服务器 2012-20120416NE\SQLEXPRESS: MYBOOKSHOPrn 如果部署的 SQL CLR 项目是为与 SQL Server 目标实例不兼容的 .NET Framework 版本生成的,则可能出现以下错误:“部署错误 SQL01268: 针对程序集的 CREATE ASSEMBLY 失败,因为验证程序集失败”。若要解决此问题,请打开项目的属性,然后更改 .NET Framework 版本。rn 部署脚本已生成到:rn F:\DataBaseTest\TriggerTest\SqlServerProject1\bin\Debug\SqlServerProject1.sqlrn rn 正在创建 [SqlServerProject1]...rnF:\DataBaseTest\TriggerTest\SqlServerProject1\bin\Debug\SqlServerProject1.sql(39-39): Deploy error SQL01268: .Net SqlClient Data Provider: 消息 6218,级别 16,状态 3,行 1 针对程序集 'SqlServerProject1' 的 CREATE ASSEMBLY 失败,原因是程序集 'SqlServerProject1' 未通过身份验证。请检查被引用程序集是否是最新的,而且是可信的(external_access 或 unsafe),能在该数据库中执行。如果有 CLR Verifier 错误消息,将显示在此消息之后 rn 执行批处理时发生错误。rnrn生成失败。rnrn已用时间 00:00:11.66rn========== 生成: 成功或最新 1 个,失败 0 个,跳过 0 个 ==========rn========== 部署: 成功 0 个,[color=#FF0000]失败[/color] 1 个,跳过 0 个 ==========rnrnrnrn各位,这个这个该如何解决???rnrnrnrnrnrnrn
vs 2015连接SQL 2008 R2失败
本机Win10用vs 2015连接不上另外一台SQL Server 2008服务器( WIN 7 64 位)rn提示:已成功与服务器建立连接,但是在登录过程中发生错误。 (provider: SSL Provider, error: 0 证书链是由不受信任的颁发机构颁发的rnrn[img=https://img-bbs.csdn.net/upload/201711/09/1510190320_695415.png][/img]rn[img=https://img-bbs.csdn.net/upload/201711/09/1510190330_16716.png][/img]rn
java连接sql数据库失败
在学习java ee中,跟踪视频学习连接sql2008数据库,引入了驱动包和sql.*,可是不知道为什么还是会报错,而且报错的行已经反复比较了视频的程序,也在网上查找了相关问题,可就是解决不了,不知道问题究竟出在哪里,这样就不能继续跟视频进行下面的学习,可是我才开始学习呢,呜呜,所以请各位帮帮忙看看问题究竟出在哪里,谢谢。rn下图是连接数据库代码截图rn[img=https://img-bbs.csdn.net/upload/201401/21/1390312006_307737.jpg][/img]rn下图是网页连接数据库报错截图rn[img=https://img-bbs.csdn.net/upload/201401/21/1390312054_677909.jpg][/img]
JSP连接SQL数据库失败
用纯java的方式连接数据库rnrnSQL有SP3的补丁了 ,版本号是760rn1433端口也打开了 rn也根据网上的教程安装了SQL SERVER2000 JDBC驱动,把三个jar文件的路径也写进了classpath中,也拷贝进了Tomcat的lib文件夹中 rnrnJSP页面是这样的rn<%@ page contentType="text/html;charset=GB2312" %>rn<%@ page import="java.sql.*" %>rnrn<% Connection con;rn Statement sql;rn ResultSet rs;rn tryClass.forName("com.microsoft.sqlserver.jdbc.SQLSereverDriver").newInstance();rn catch(Exception e)out.print(e);rn try String url="jdbc:sqlserver://127.0.0.1:1500;DatabaseName=Student";rn String user="sa";rn String password="123";rn con=DriverManager.getConnection(url,user,password);rn sql=con.createStatement();rn rs=sql.executeQuery("SELECT * FROM wares");rn out.print(" ");rn out.print(" ");rn out.print(" "+"商品编号");rn out.print(" "+"商品名称");rn out.print(" "+"商品价格");rn out.print(" "+"商品数量");rn out.print("");rn while(rs.next())rn out.print(" ");rn out.print(" "+rs.getString(1)+""); rn out.print(" "+rs.getString(2)+"");rn out.print(" "+rs.getFloat("商品价格")+""); rn out.print(" "+rs.getFloat("商品数量")+"");rn rn out.print("") ; rn rn out.print("");rn con.close();rn rn catch(SQLException e1) rn out.print(e1);rn rn %>rnrnrnrn用桥连接的时候能显示数据,就是用这个方法连接的时候有错误rnrn错误提示rnrnjava.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLSereverDriverjava.sql.SQLException: No suitable driver found for jdbc:sqlserver://127.0.0.1:1500;DatabaseName=Student rnrn已经找了半天了 也没解决 不知道到底是怎么回事 求帮助
sql 数据库中的连接问题
web.config 中的配置如下:rnrnrn请问我如何在程序中调用数据库?最好能用VB为例子! 谢谢各位
vs与SQL 2005连接问题
我的vs与SQL连接都很正常,就是在做项目的时候,发现在vs与sql连接插入数据只能插入英文字母和数字,我在vs里面写的SQL语句里面插入的汉字到了数据库全部都显示的是?????,返回的查询结果也是这样的啊,郁闷啊!!!!我直接在数据库里可以插入汉字的啊,应该是数据库的问题吧?那位高人指点以下啊?
VS(VB)2015与SQL数据库的连接及查询.
本人超新手一个,最近自学要用到数据库了,在网上找了好久也不行,各位大大帮帮忙,小的万分感谢.rn1.在VS内的SQL中已建了一个数据,rn2.在外部单独的SQL2014中也建了一个rn建好后不知道怎么连接,访问,查迅,代码不知道怎么写.(真新手,不要笑哈)rnrnVS2015的书网上也没新手学的卖,给VB6.0差得有点多.rnrn[img=https://img-bbs.csdn.net/upload/201603/24/1458804196_347368.jpg][/img]rnrn[img=https://img-bbs.csdn.net/upload/201603/24/1458804508_632037.jpg][/img]rnrn[img=https://img-bbs.csdn.net/upload/201603/24/1458804230_561308.jpg][/img]
VS连接Sql Server数据库找不到服务…
在用vs2015连接sqlserver2014时,出现找不到本地服务器的情况,刷新刷不出来。 在尝试过后通过以下方法解决: 1)打开sqlserver配置管理器,选择“sql sever服务”,检查“SQL Server”“SQL Server ReportingService”服务状态,确保为正在运行。 尝试后发现网友这种方法还不能解决问题。 2)同样在sqlserver
VS连接SQL
VS2010连接数据库SQL2000有什么要求吗?我使用的是VS2010版本,由于,这家企业的子公司使用的是用友ERP软件,数据库是SQL2000连接的时候,连接字段和数据库的命令都是一样的吧。我的后台代码使用的都是数据库的命令(自己的机器使用的是SQL2008),应该都能用吧
【VS】连接SQL的基本操作
反反复复弄了两天终于搞清楚了个大概坑很多。先贴代码using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using ...
VS与SQL Server的连接
安装vs2010和sql2008。安装sql2008的时候设置登录模式为混合模式
vs 2010链接数据库失败
[img=http://img.my.csdn.net/uploads/201303/14/1363268479_5988.png][/img]rn我在vs2010 用asp.net(C#)链接数据库时,出现如上图所示错误,链接数据库的代码如下:rnSqlConnection sqlConn = new SqlConnection("server=(localhost);uid=tao;pwd=tao;database=Exam;");rn DataSet ds = new DataSet();rn SqlDataAdapter myComm = new SqlDataAdapter("select ProName from Province", sqlConn);rn [color=#FF0000]myComm.Fill(ds);[/color]rn sqlConn.Close();rn为什么 myComm.Fill(ds); 这一行会报错?rn我用其他的项目试过,数据库连接没有问题,why??
连接SQL 数据库 vs中成功但是Excel中失败,方法都是一样的
在Vs中:rn[img=https://img-bbs.csdn.net/upload/201509/23/1442980125_334296.png][/img]rnrn在Excel中:rn[img=https://img-bbs.csdn.net/upload/201509/23/1442980183_376282.png][/img]rnrn服务器名、 用户ID 、和密码都是一样的,为什么会出现两种不同的结果啊??
连接SQL Server 2000 数据库失败!!!
我用下面的语句,但是在运行时提示:原因:登陆不正确。rn请教各位大哥大姐怎么解决!!!感谢!!rnSQLCA.DBMS = "MSS Microsoft SQL Server 6.x"rnSQLCA.LogPass = "***"rnSQLCA.ServerName = "wangjun"rnSQLCA.LogId = "sa"rnSQLCA.AutoCommit = FalsernSQLCA.DBParm = ""rnrnconnect using SQLCA;rnif sqlca.sqlcode<>0 thenrn messagebox("提示!","原因:"+sqlca.sqlerrtext)rn returnrnend ifrnopen(w_login);rn
myeclipse连接sql数据库 用户登录‘sa’失败
这是连接文件[code=Java][/code]package com.zzx.util;rnrnimport java.sql.*;rnrnrnpublic class DataConn rn rn public static void main(String[] srg) rn new DataConn().getConn();rn //System.out.println("conn successfully");rn rn /* rn * mysql数据库驱动rn * */rn// final String driver = "com.mysql.jdbc.Driver";rn// final String url = "jdbc:mysql://localhost:3306/jpkc";rn// final String user = "root";rn// final String password = "root";rnrn rn //sql server 2000的数据驱动rn final String driver = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; // 加载server2000 JDBC驱动rn final String url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=jpkc"; // 连接服务器和数据库rn final String user = "sa";rn final String password = "sa";rn rn rn// final String driver ="net.sourceforge.jtds.jdbc.Driver";rn// final String url = "jdbc:jtds:sqlserver://localhost:1433/jpkc";rn// final String user = "sa";rn// final String password = "123456";rn rn static Connection conn = null;rnrn public DataConn() rn try rn Class.forName(driver);rn catch (ClassNotFoundException e) rn e.printStackTrace();rn System.out.println("驱动类加载失败!");rn rn try rn conn = DriverManager.getConnection(url, user, password);rn rn catch (SQLException e) rn e.printStackTrace();rn System.out.println("连接数据库失败!");rn rn rnrn public Connection getConn() rn return conn;rn rn rn public void closeConn() rn try rn conn.close();rn catch (SQLException e) rn System.out.println("和数据库断开连接失败!");rn rn rn rnrn [color=#FF0000] [b]我用myeclipse建立数据库连接的时候就是按这个来的(我用的是sql2000).在myeclypse加载工程文件,在地址栏可以看到首页的内容,但是点下相关的内容就有错误了,老师说的数据库连接的问题。这时我发现myeclpise显示用户登录‘sa’失败等信息。我的数据库登录名和密码都是sa.错误信息如下[/b][/color]用户 'sa' 登录失败。 at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)rn at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2816)rn at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2254)rn at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:602)rn at net.sourceforge.jtds.jdbc.ConnectionJDBC2.(ConnectionJDBC2.java:344)rn at net.sourceforge.jtds.jdbc.ConnectionJDBC3.(ConnectionJDBC3.java:50)rn at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:182)rn at java.sql.DriverManager.getConnection(Unknown Source)rn at java.sql.DriverManager.getConnection(Unknown Source)rn at com.zzx.util.DataConn.(DataConn.java:43)rn at com.zzx.manager.NewsManager.queryCount(NewsManager.java:108)rn at org.apache.jsp.jiaocai_jsp._jspService(jiaocai_jsp.java:75)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Unknown Source)rn连接数据库失败!rn2011-4-24 20:14:00 org.apache.catalina.core.StandardWrapperValve invokern严重: Servlet.service() for servlet jsp threw exceptionrnjava.lang.NullPointerExceptionrn at com.zzx.manager.NewsManager.queryCount(NewsManager.java:118)rn at org.apache.jsp.jiaocai_jsp._jspService(jiaocai_jsp.java:75)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Unknown Source)rn2011-4-24 20:24:58 org.apache.catalina.core.ApplicationContext logrn信息: HTMLManager: list: Listing contexts for virtual host 'localhost'rnjava.sql.SQLException: 用户 'sa' 登录失败。rn at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368)rn at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2816)rn at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2254)rn at net.sourceforge.jtds.jdbc.TdsCore.login(TdsCore.java:602)rn at net.sourceforge.jtds.jdbc.ConnectionJDBC2.(ConnectionJDBC2.java:344)rn at net.sourceforge.jtds.jdbc.ConnectionJDBC3.(ConnectionJDBC3.java:50)rn at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:182)rn at java.sql.DriverManager.getConnection(Unknown Source)rn at java.sql.DriverManager.getConnection(Unknown Source)rn at com.zzx.util.DataConn.(DataConn.java:43)rn at com.zzx.manager.TechManager.queryCount(TechManager.java:217)rn at org.apache.jsp.laoshi_jsp._jspService(laoshi_jsp.java:77)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Unknown Source)rn连接数据库失败!rn2011-4-24 20:25:13 org.apache.catalina.core.StandardWrapperValve invokern严重: Servlet.service() for servlet jsp threw exceptionrnjava.lang.NullPointerExceptionrn at com.zzx.manager.TechManager.queryCount(TechManager.java:227)rn at org.apache.jsp.laoshi_jsp._jspService(laoshi_jsp.java:77)rn at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)rn at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)rn at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)rn at java.lang.Thread.run(Unknown Source)rn
MFC ADO连接SQL数据库 查询失败
[code=c] if(m_list)rn m_list.DeleteAllItems();rn int intm;rn tryrn rn _variant_t RecordsAffected;rn _bstr_t name, sex,age;rnrn m_pRecordset = m_pConnection->Execute("select isnull(名字,'0'),isnull(性 别,'0'),isnull(年龄,'0') from student1 ",&RecordsAffected,adCmdText); rn while(!m_pRecordset->adoEOF)rn //获取表中信息rn name= m_pRecordset->GetCollect("名字");rn sex=m_pRecordset->GetCollect("性别");rn age=m_pRecordset->GetCollect("年龄");rn //显示表中信息rn intm=m_list.InsertItem(0,(_bstr_t)name);rn m_list.SetItem(intm,1,1,(_bstr_t)sex,NULL,0,0,0);rn m_list.SetItem(intm,2,1,(_bstr_t)age,NULL,0,0,0);rn m_pRecordset->MoveNext();rn rnrn AfxMessageBox("查询成功!");rn rn catch (_com_error e)rn rn CString errormessage;rn errormessage.Format("查询失败!\r\n错误信息:%s",e.ErrorMessage());rn AfxMessageBox(errormessage);rn return ;rn rn[/code]rn其中m_list 列表框变量rn查询错误 IDispatch错误#3092rnselect isnull(名字,'0'),isnull(性 别,'0'),isnull(年龄,'0') from student1 这句在查询里面是正确的
连接SQL SERVER 数据库,出现 登录失败?
今天我用ConnectString="srver=(local);database=pubs;Trusted_Connection=yes"连接数据库时,出现System.Data.SqlClient.SqlException: 用户 'NT AUTHORITY\NETWORK SERVICE' 登录失败,哪位高手帮帮忙啊?
sql数据库的连接问题
在连接sql数据库时候总是提示“错误枚举数据服务器 枚举服务报告‘未指定的错误’。rn 在连接access的时候是没有问题的。。。rn帮帮忙。谢谢了。rnrn
连接SQL数据库的问题!
我是通过使用网络登陆ID的WINDOWSNT验证来连接SQL数据库的,请问在ASP网页连接SQL数据库的时候UID和PWD填什么?
连接sql数据库的问题!
我的sqlserver没有密码rn库文件是huipricern我建立的odbc数据源是huirn在建立数据源的时候选则的:是使用网络登陆id的windows验证rnodbc测试通过rnrn我的程序连接应该这么写呢?rn谢谢!rn另外odbc连接是不是建在系统dsn上?rn系统和用户有什么区别?rnrnrn
连接SQL数据库的问题
ConnectionString1= "Server=localhost;uid=sa;pwd=123;database=pubs";rnrnConnectionString2= "server=localhost;database=pubs;integrated security=SSPI";rnrn请问这两句是否是对应与SQL SERVER的两种身份验证模式?rnrn用ConnectionString1,SQL SERVER2000身份验证为“SQL SERVER和WINDOWS",可以顺利连接;rnrn用ConnectionString2,SQL SERVER2000身份验证为“仅WINDOWS",却无法连接;rn请问各位大侠?
SQL数据库 连接问题
1。 [服务帐号]选“对每个服务使用同一帐号。自动启动SQL Server 服务”rn   [服务设置]选] “使用域用户帐号” 用户名:zz1 密码:空 域:LVQBrnrn  这个用户是做什么用的 域又是干什么的rn              rnrn2。 [身份验证模式]选 混合模式(windows身份验证和SQL server身份验证)rn   添加sa登录密码  密码:sarnrn   SA是什么东西,这里的身份验证 是哪里用的
SQL 数据库的连接问题
我的程序在Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver ");这个地方报错。rn我自己分析可能是Sp3包没装好,但是我查看了其版本号显示是:8.00.760 ,那就证明Sp3已经装上了。rn驱动什么的都装了。现在是找不到原因。请赐教!
连接sqlserver2005数据库失败?
[code=C/C++]HRESULT hr;rn tryrn rn hr = m_pConnection.CreateInstance("ADODB.Connection");///创建Connection对象rn if(SUCCEEDED(hr))rn rn hr = m_pConnection->Open("Provider=SQLOLEDB.1;Data Source=71A5E5EC09B449B\\administrator;Database=TTIM4;Trusted_Connection=yes","","",adModeUnknown);///连接数据库rn ///上面一句中连接字串中的Provider是针对ACCESS2000环境的,对于ACCESS97,需要改为:Provider=Microsoft.Jet.OLEDB.3.51; rn rn rn catch(_com_error e)///捕捉异常rn rn CString errormessage;rn errormessage.Format(L"连接数据库失败!\r\n错误信息:%s",e.ErrorMessage());rn AfxMessageBox(errormessage);///显示错误信息rn return FALSE;rn [/code]rn怎么回事?谢谢!!
连接远端数据库失败
development:rn adapter: mysqlrn encoding: utf8rn database: namern username: userrn password: 123456rn host: 10.20.128.152rnrn这样配置数据库来访问内网其他机器的数据库!rn报错!rnrnMysql::Error (Client does not support authentication protocol requested by server; consider upgrading MySQL client):rn c:/ruby/lib/ruby/1.8/mysql.rb:453:in `read'rn c:/ruby/lib/ruby/1.8/mysql.rb:130:in `real_connect'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:471:in `connect'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:165:in `initialize'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:88:in `new'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:88:in `mysql_connection'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:in `send'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:in `connection='rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:259:in `retrieve_connection'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in `connection'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1080:in `columns'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1088:in `columns_hash'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/attribute_methods.rb:63:in `define_attribute_methods'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/attribute_methods.rb:290:in `respond_to?'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session/cookie_store.rb:133:in `dump'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session/cookie_store.rb:133:in `marshal'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session/cookie_store.rb:111:in `close'rn c:/ruby/lib/ruby/1.8/cgi/session.rb:324:in `close'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1247:in `close_session'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1292:in `process_cleanup_without_flash'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/flash.rb:173:in `process_cleanup_without_session_management_support'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:133:in `process_cleanup_without_components'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/components.rb:161:in `process_cleanup'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:532:in `process_without_filters'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in `process_without_session_management_support'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in `process'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in `handle_request'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'rn c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:112:in `handle_dispatch'rn c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:78:in `service'rn c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'rn c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'rn c:/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'rn c:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'rn c:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'rn c:/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'rn c:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'rn c:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'rn c:/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'rn c:/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'rn c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:62:in `dispatch'rn c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/webrick.rb:66rn c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'rn c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'rn c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'rn c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'rn c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'rn c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39rn c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'rn c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'rn script/server:3rnrn/!\ FAILSAFE /!\ 2010年08月20日 15时29分rn Status: 500 Internal Server Errorrn Client does not support authentication protocol requested by server; consider upgrading MySQL clientrn c:/ruby/lib/ruby/1.8/mysql.rb:453:in `read'rn c:/ruby/lib/ruby/1.8/mysql.rb:130:in `real_connect'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:471:in `connect'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:165:in `initialize'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:88:in `new'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:88:in `mysql_connection'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:in `send'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:in `connection='rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:259:in `retrieve_connection'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in `connection'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1080:in `columns'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1088:in `columns_hash'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/attribute_methods.rb:63:in `define_attribute_methods'rn c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/attribute_methods.rb:290:in `respond_to?'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session/cookie_store.rb:133:in `dump'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session/cookie_store.rb:133:in `marshal'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session/cookie_store.rb:111:in `close'rn c:/ruby/lib/ruby/1.8/cgi/session.rb:324:in `close'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1247:in `close_session'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1292:in `process_cleanup_without_flash'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/flash.rb:173:in `process_cleanup_without_session_management_support'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:133:in `process_cleanup_without_components'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/components.rb:161:in `process_cleanup'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:532:in `process_without_filters'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in `process_without_session_management_support'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in `process'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in `handle_request'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi'rn c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'rn c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:112:in `handle_dispatch'rn c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:78:in `service'rn c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'rn c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'rn c:/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'rn c:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start'rn c:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'rn c:/ruby/lib/ruby/1.8/webrick/server.rb:95:in `start'rn c:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each'rn c:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `start'rn c:/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start'rn c:/ruby/lib/ruby/1.8/webrick/server.rb:82:in `start'rn c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:62:in `dispatch'rn c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/webrick.rb:66rn c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'rn c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'rn c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'rn c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'rn c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'rn c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39rn c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'rn c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'rn script/server:3rn
连接sql2005数据库失败
[code=c]BOOL CLZJDataBase::doQuery(CString strSQL, _RecordsetPtr &pRecordset)rn rn if (m_bOpened == FALSE) return FALSE;rn pRecordset.CreateInstance(__uuidof(Recordset));rn pRecordset->CursorLocation = adUseClient;rn HRESULT hr;rn tryrn rn hr = pRecordset->Open(_bstr_t(strSQL), m_Connection.GetInterfacePtr(), adOpenForwardOnly, adLockReadOnly, adCmdText); rn rn catch (_com_error e) rn rn CString strValue;rn CString strDNS = GetConnectString();rn m_Connection->Close();rn m_Connection.Release();rn rn strValue.Format(_T("<%s> %s--------\n"), GetTime(), strDNS); rn GWriteLog(strValue);rn rn HRESULT hr = m_Connection.CreateInstance(__uuidof(Connection));rn hr = m_Connection->Open(_bstr_t(strDNS), "", "", -1); rn rn strValue.Format(_T("<%s> ReConnect---------- SQL = %s\n"), GetTime(), strSQL); rn GWriteLog(strValue);rn rn if(FAILED(hr))rn rn CString strValue;rn strValue.Format(_T("<%s> Reconnect Error---------- SQL = %s\n"), GetTime(), strSQL); rn GWriteLog(strValue); rn _tprintf(strValue); rn return FALSE;rn rn elsern rn m_bOpened = TRUE;rn hr = pRecordset->Open(_bstr_t(strSQL), m_Connection.GetInterfacePtr(), adOpenForwardOnly, adLockReadOnly, adCmdText);rn return TRUE;rn rn rn return TRUE;rnrnCString CLZJDataBase::GetConnectString()rnrn CString strIP;rn GetPrivateProfileString(_T("DataBase"), _T("IP"), _T(""), strIP.GetBufferSetLength(MAX_PATH), MAX_PATH, getPath() + "\\config.ini");rn strIP.ReleaseBuffer();rn strIP.TrimLeft();rn strIP.TrimRight();rn rn CString strPort;rn GetPrivateProfileString(_T("DataBase"), _T("PORT"), _T(""), strPort.GetBufferSetLength(MAX_PATH), MAX_PATH, getPath() + "\\config.ini");rn strPort.ReleaseBuffer();rn strPort.TrimLeft();rn strPort.TrimRight();rn rn CString strDB;rn GetPrivateProfileString(_T("DataBase"), _T("DB"), _T(""), strDB.GetBufferSetLength(MAX_PATH), MAX_PATH, getPath() + "\\config.ini");rn strDB.ReleaseBuffer();rn strDB.TrimLeft();rn strDB.TrimRight();rn rn CString strLoginName;rn GetPrivateProfileString(_T("DataBase"), _T("LoginName"), _T(""), strLoginName.GetBufferSetLength(MAX_PATH), MAX_PATH, getPath() + "\\config.ini");rn strLoginName.ReleaseBuffer();rn strLoginName.TrimLeft();rn strLoginName.TrimRight();rn rn CString strPassword;rn GetPrivateProfileString(_T("DataBase"), _T("Password"), _T(""), strPassword.GetBufferSetLength(MAX_PATH), MAX_PATH, getPath() + "\\config.ini");rn strPassword.ReleaseBuffer();rn strPassword.TrimLeft();rn strPassword.TrimRight();rn rn CString strDNS = "Provider=SQLOLEDB;SERVER=" + strIP + _T(",") + strPort + "; DATABASE=" + strDB + ";UID="+strLoginName+";PWD=" + strPassword; //不能有空格rn return strDNS;rn[/code]rn[img=https://img-bbs.csdn.net/upload/201311/29/1385686918_298351.jpg][/img]rnrnconfig.inirn[code=css][DataBase]rnLoginName=sa rnPassword=123rnIP=71A5E5EC09B449B\\XIAOYErnDB=yschatrnPort=2820rn[software]rnver=100rntcpport=8500rnServerType=0rn[FtpServer]rnIP=127.0.0.1rnport=21rnname=xiaoyernpassword=123[/code]rn提示连接失败,怎么办?谢谢!
连接本地数据库失败
我在服务器上将程序和数据库下载下来了 数据库附加到我本地的数据库里了 rn我也将config文件修改成了连接我本地的数据了 rn可是为什么一连接的时候 就会出现以下的错误 rnrnOffending URL: http://localhost:1104/default.aspxrnSource: .Net SqlClient Data Providerrn[b]Message: 在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: SQL 网络接口, error: 26 - 定位指定的服务器/实例时出错)[/b]rnStack trace: 在 JumboTCMS.UI.BasicPage.ConnectDb() 位置 D:\Documents\Desktop\备份www.bhjb.so\JumboTCMS_V5.1.0\JumboTCMS_V5.1.0\JumboTCMS_WebWAN\JumboTCMS.UI\BasicPage.cs:行号 122rn 在 JumboTCMS.UI.BasicPage.LoadJumboTCMS() 位置 D:\Documents\Desktop\备份www.bhjb.so\JumboTCMS_V5.1.0\JumboTCMS_V5.1.0\JumboTCMS_WebWAN\JumboTCMS.UI\BasicPage.cs:行号 47rn 在 JumboTCMS.UI.BasicPage.OnInit(EventArgs e) 位置 D:\Documents\Desktop\备份www.bhjb.so\JumboTCMS_V5.1.0\JumboTCMS_V5.1.0\JumboTCMS_WebWAN\JumboTCMS.UI\BasicPage.cs:行号 41rn 在 JumboTCMS.UI.FrontHtml.OnInit(EventArgs e) 位置 D:\Documents\Desktop\备份www.bhjb.so\JumboTCMS_V5.1.0\JumboTCMS_V5.1.0\JumboTCMS_WebWAN\JumboTCMS.UI\FrontHtml.cs:行号 26rn 在 System.Web.UI.Control.InitRecursive(Control namingContainer)rn 在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)rnrn我是连接的本地数据库 为什么还会这样的 请各位高手快帮帮小弟吧 快疯了
SQL数据库的连接问题
从朋友那里拷贝了一个网站,用的SQL数据库rn数据库拷的是他备份的一个,在本机上还原rn但还是无法显示页面rn请问一下这种用SQL的网站相互之间拷贝哪些东西要设置好才可以正常运行rn要注意哪些东西rn请各位指教
连接sql数据库的问题
为什么总说变量未设置呢rnPrivate Sub Command1_Click()rnDim cnn As ADODB.ConnectionrnDim rst As ADODB.RecordsetrnConnectString = "FileDSN=stu1.dsn;UID=sa;PWD="rncnn.Open ConnectStringrnSQL = "select * from user_info"rnrst.Open SQL, cnn, adOpenKeyset, adLockOptimisticrnEnd Sub
连接sql的数据库更新失败
Set rs = Server.CreateObject("ADODB.Recordset")rnrs.ActiveConnection = MM_conn_STRINGrnrs.Source = "股票表"rnrs.CursorType =0rnrs.CursorLocation =3rnrs.LockType = 1rnrs.Open()rnrs.AbsolutePosition = RecNornrs("股票代号") = Request("股票代号")rnrs.Updatern更新失败rnrs("股票代号") = Request("股票代号")rn会报告错误。但是定位之后rnresponse.Write(rs("股票代号"))rn却没有问题,请不明原因,请高手指点rn
连接SQL Server失败!!!
我在安装SQL Server 时选择Windows验证模式,rnrnSet conn = Server.CreateObject("ADODB.Connection") rnconn.Open "driver=SQL Server;server=127.0.0.1;database=留言"rnrn老是说我连接失败,说我用户名登录错误。rnrn怎样写才行呢?rnrn
php连接sql失败
代码:$dbc = mysqli_connect('localhost','tom', '123123', 'aliendatabase')rn or die('Error connecting to MySQL server.');rn也分离了数据库一个mdf和一个ldf文件放在同一个文件夹中。rn但是测试时还是出错,好像是无法连接SQL服务器位置:rnWarning: mysqli_connect() [function.mysqli-connect]: (HY000/2003): Can't connect to MySQL server on 'localhost' (10061) in E:\Learing\phpWeb\aliens\report.php on line 22rnError connecting to MySQL server.rn我用的是Microsoft SQL Server 2005,我的SQL是连接服务器的了,用户名和密码也没有错。求解。
连接sql失败
我用odbc连接sql server,代码如下:rn_bstr_t str="DSN=AA;UID=sa;PWD=111111";rnconn->open(str,"",",-1);rn为什么总是异常,报无效指针??????????rn我进入查询分析器的时候用 sa,111111是可以连接的呀,这是怎么回事,请问系统dsn和用户dsn有什么区别吗??????????
asp 连接sql失败
错误信息是microsoft ole do provider for odbc driver(0x80040e4d)rn就是一个非常普通的错误信息.rn我怀疑是不是用户名与密码的问题.rn电脑是2000 server.是单机.rn安装sql的时候选择的是本机登陆验证(对应的是域登陆验证),rn然后选择了windows登陆验证(没选sql验证)rnrn我想编辑服务器注册,改成sql登陆.却不让我改.rn我在企业管理器建立了一个用户,给它设置了登陆密码.rn我登陆查询分析器的时候,选择windows登陆就能进,而选择sql登陆,输入我新建用户的用户名与密码,却无法登陆.显示未与信任的sql关联.rnrn
在vs中使用Qt连接SQLServer数据库
更多0 c++数据库 //1.添加SQL库:“Qt project setting”–&gt;“Qt Modules”,在SQL library复选框前打勾. //2.添加头文件 #include #include &lt;QtSql/QSqlDatabase&gt; #include &lt;QtSql/QSqlTableModel&gt; #include&lt;QtSql/QSqlError...
相关热词 c# stream 复制 android c# c#监测窗口句柄 c# md5 引用 c# 判断tabtip 自己写个浏览器程序c# c# 字符串变成整数数组 c#语言编程写出一个方法 c# 转盘抽奖 c#选中treeview