Gets or sets the name of the application associated with the connection string. C# 复制 public string ApplicationName { get; set; } Property Value String The name of the application, or ".NET SqlClient Data Provider" if no name has been supplied. Exceptions ArgumentNullException ...
ConnectionString主要要认清他的几个关键字,这里也主要介绍一下他的光健字,他的将不在这里讲述: Application Name:应用程序的名称,如果不提供应用程序名称,默认为“.Net SqlClient Data Provider”。 AttachDBFilename/extended properties/Initial File Name:可连接数据库的主文件的名称,包括完整的路径名,必须使用关键...
SqlConnection myConnection = new SqlConnection(); myConnection.ConnectionString = "Persist Security Info=False;Integrated Security=SSPI;database=northwind;server=mySQLServer;Connect Timeout=30"; myConnection.Open();
attribute-value ::= character-string attribute-keyword ::= identifier quote ::= " | ' 屬性的使用必須符合其範圍內所允許的語法。 例如,WSID會使用大括號 ({}) 字元,而Application Name會使用單引號 (') 或雙引號 (") 字元。 只有字串屬性可以加上引號。 嘗試引用整數或列舉屬性會導致「連接字串不符...
ConnectionString 屬性 參考 意見反應 定義 命名空間: System.Data.SqlClient 組件: System.Data.SqlClient.dll 套件: System.Data.SqlClient v4.9.0 來源: System.Data.SqlClient.notsupported.cs 取得或設定用來開啟 SQL Server 資料庫的字串。 C# 複製 public override string ConnectionString { get; ...
String 連接字串,包含來源資料庫名稱和其他建立初始連接所需要的參數。 預設值為空字串。 例外狀況 ArgumentException 已提供無效的連接字串引數,或尚未提供必要的連接字串引數。 範例 下列範例會建立 ,SqlConnection並在開啟連接之前設定ConnectionString屬性。
Namespace: System.Data.SqlClient Assembly: System.Data.SqlClient.dll Package: System.Data.SqlClient v4.9.0 Source: System.Data.SqlClient.notsupported.cs Gets or sets the string used to open a SQL Server database. C#Copy publicoverridestringConnectionString {get;set; } ...
可以使用ConnectionString属性连接到数据库。下面的示例阐释了一个典型的连接字符串。 代码语言:javascript 代码运行次数:0 运行 AI代码解释 "Persist Security Info=False;Integrated Security=SSPI;database=northwind;server=mySQLServer" 只有在连接关闭时才能设置ConnectionString属性。许多连接字符串值都具有相应的只读属性...
SQL SERVER 数据库连接字符串配置:https://learn.microsoft.com/en-u ... on.connectionstring ...
String 连接字符串,其中包含源数据库名称和建立初始连接所需的其他参数。 默认值为一个空字符串。 例外 ArgumentException 提供了一个无效的连接字符串参数,或者未提供所需的连接字符串参数。 示例 以下示例在打开连接之前创建SqlConnection并设置ConnectionString属性。