zoukankan      html  css  js  c++  java
  • sql server连接字符串与tcp/ip开启

    连接字符串1:Data Source=localhost,1433;User ID=sa;Password=123;Initial Catalog=test;Min Pool Size=1;Max Pool Size = 512;

    连接字符串2:Data Source=localhost;User ID=sa;Password=123;Initial Catalog=test;

    SQL SERVER数据库中的TCP/IP如果没有开启,只能用第二句连接字符串,开启都可用。字符串1是通过走网络的。

    如果你应用了第一句字符串,必须在SQL server配置器中开启tcp/ip,然后重启sql server服务。就OK

    否则报错

    System.Data.SqlClient.SqlException: 在向服务器发送请求时发生传输级错误。 (provider: TCP 提供程序, error: 0 - 远程主机强迫关闭了一个现有的连接。)    在 System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)    在 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)    在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)    在 System.Data.SqlClient.TdsParserStateObject.WriteSni()    在 System.Data.SqlClient.TdsParserStateObject.WritePacket(Byte flushMode)    在 System.Data.SqlClient.TdsParserStateObject.ExecuteFlush()    在 System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc)    在 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)    在 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)    在 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)    在 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)    在 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior)    在 EISSQLServerDAL.SqlHelper.ExecuteReader(SqlConnection connection, SqlTransaction transaction, CommandType commandType, String commandText,

  • 相关阅读:
    Visual Studio 存在版本之间冲突
    Failed to load resoure:the serve responded with a status of 405 (Method Not Allowed)
    Excel 导入解析数据 NPOIExcelHelper
    WIN10 SERVICES -- 部署IIS
    高德地图API-搜索提示并定位到位置,卫星地图和标准地图的切换
    BIMFCE选择全量绘制
    JS中如何获取当前日期,并与输入日期作比较
    html中input标签放入小图标
    div跟随浏览器大小而改变
    vue-amap接入高德地图示例
  • 原文地址:https://www.cnblogs.com/Anders888/p/4629177.html
Copyright © 2011-2022 走看看