SqlConnection Sınıf
Tanım
SQL Server veritabanına olan bağlantıyı temsil eder.Represents a connection to a SQL Server database. Bu sınıf devralınamaz.This class cannot be inherited.
public ref class SqlConnection sealed : System::Data::Common::DbConnection, ICloneable
public ref class SqlConnection sealed : System::Data::Common::DbConnection
public ref class SqlConnection sealed : System::ComponentModel::Component, ICloneable, IDisposable, System::Data::IDbConnection
public ref class SqlConnection sealed : System::Data::Common::DbConnection, ICloneable, IDisposable
public sealed class SqlConnection : System.Data.Common.DbConnection, ICloneable
public sealed class SqlConnection : System.Data.Common.DbConnection
public sealed class SqlConnection : System.ComponentModel.Component, ICloneable, IDisposable, System.Data.IDbConnection
public sealed class SqlConnection : System.Data.Common.DbConnection, ICloneable, IDisposable
type SqlConnection = class
inherit DbConnection
interface ICloneable
type SqlConnection = class
inherit DbConnection
type SqlConnection = class
inherit Component
interface IDbConnection
interface IDisposable
interface ICloneable
type SqlConnection = class
inherit DbConnection
interface IDbConnection
interface ICloneable
interface IDisposable
Public NotInheritable Class SqlConnection
Inherits DbConnection
Implements ICloneable
Public NotInheritable Class SqlConnection
Inherits DbConnection
Public NotInheritable Class SqlConnection
Inherits Component
Implements ICloneable, IDbConnection, IDisposable
Public NotInheritable Class SqlConnection
Inherits DbConnection
Implements ICloneable, IDisposable
- Devralma
- Devralma
- Devralma
- Uygulamalar
Örnekler
Aşağıdaki örnek bir ve oluşturur SqlCommand SqlConnection .The following example creates a SqlCommand and a SqlConnection. SqlConnectionAçılır ve için olarak ayarlanır Connection SqlCommand .The SqlConnection is opened and set as the Connection for the SqlCommand. Örnek daha sonra çağırır ExecuteNonQuery .The example then calls ExecuteNonQuery. Bunu gerçekleştirmek için, ExecuteNonQuery bir bağlantı dizesi ve bir Transact-SQL INSERT ifadesiyle bir sorgu dizesi geçirilir.To accomplish this, the ExecuteNonQuery is passed a connection string and a query string that is a Transact-SQL INSERT statement. Kod, using bloğundan çıktığında bağlantı otomatik olarak kapatılır.The connection is closed automatically when the code exits the using block.
private static void CreateCommand(string queryString,
string connectionString)
{
using (SqlConnection connection = new SqlConnection(
connectionString))
{
SqlCommand command = new SqlCommand(queryString, connection);
command.Connection.Open();
command.ExecuteNonQuery();
}
}
Public Sub CreateCommand(ByVal queryString As String, _
ByVal connectionString As String)
Using connection As New SqlConnection(connectionString)
Dim command As New SqlCommand(queryString, connection)
command.Connection.Open()
command.ExecuteNonQuery()
End Using
End Sub
Açıklamalar
Bir SqlConnection nesne SQL Server veri kaynağına yönelik benzersiz bir oturumu temsil eder.A SqlConnection object represents a unique session to a SQL Server data source. İstemci/sunucu veritabanı sistemiyle, sunucusuyla bir ağ bağlantısıyla eşdeğerdir.With a client/server database system, it is equivalent to a network connection to the server. SqlConnection , SqlDataAdapter ve SqlCommand bir Microsoft SQL Server veritabanına bağlanırken performansı artırmak için ile birlikte kullanılır.SqlConnection is used together with SqlDataAdapter and SqlCommand to increase performance when connecting to a Microsoft SQL Server database. Tüm üçüncü taraf SQL Server ürünleri ve diğer OLE DB desteklenen veri kaynakları için kullanın OleDbConnection .For all third-party SQL Server products and other OLE DB-supported data sources, use OleDbConnection.
Bir örneği oluşturduğunuzda SqlConnection , tüm özellikler ilk değerlerine ayarlanır.When you create an instance of SqlConnection, all properties are set to their initial values. Bu değerlerin bir listesi için, SqlConnection oluşturucuya bakın.For a list of these values, see the SqlConnection constructor.
ConnectionStringBir bağlantı dizesindeki anahtar sözcüklerin listesi için bkz..See ConnectionString for a list of the keywords in a connection string.
SqlConnectionKapsam dışına geçtiğinde, kapanmayacaktır.If the SqlConnection goes out of scope, it won't be closed. Bu nedenle, veya çağırarak bağlantıyı açıkça kapatmanız gerekir Close Dispose .Therefore, you must explicitly close the connection by calling Close or Dispose. Close ve Dispose işlevsel olarak eşdeğerdir.Close and Dispose are functionally equivalent. Bağlantı havuzu oluşturma değeri Pooling veya olarak ayarlandıysa true yes , arka plandaki bağlantı bağlantı havuzuna geri döndürülür.If the connection pooling value Pooling is set to true or yes, the underlying connection is returned back to the connection pool. Öte yandan, Pooling veya olarak ayarlandıysa false no , sunucu ile ilgili temel bağlantı aslında kapalıdır.On the other hand, if Pooling is set to false or no, the underlying connection to the server is actually closed.
Not
Bağlantı, bağlantı havuzuna döndürüldüğünden bağlantı, gerçekten kapanmadığı için, bağlantı havuzundan bir bağlantı getirilirken ya da geri döndürülene kadar sunucuda oturum açma ve oturum kapatma olayları oluşturulmaz.Login and logout events will not be raised on the server when a connection is fetched from or returned to the connection pool, because the connection is not actually closed when it is returned to the connection pool. Daha fazla bilgi için bkz. SQL Server bağlantı havuzu (ADO.net).For more information, see SQL Server Connection Pooling (ADO.NET).
Bağlantıların her zaman kapatılmasını sağlamak için, using Aşağıdaki kod parçasında gösterildiği gibi, bağlantıyı bir bloğun içinde açın.To ensure that connections are always closed, open the connection inside of a using block, as shown in the following code fragment. Bunun yapılması, kodun bloğundan çıkıldığında bağlantının otomatik olarak kapatılmasını sağlar.Doing so ensures that the connection is automatically closed when the code exits the block.
Using connection As New SqlConnection(connectionString)
connection.Open()
' Do work here; connection closed on following line.
End Using
using (SqlConnection connection = new SqlConnection(connectionString))
{
connection.Open();
// Do work here; connection closed on following line.
}
Not
Yüksek performanslı uygulamaları dağıtmak için bağlantı havuzu kullanmanız gerekir.To deploy high-performance applications, you must use connection pooling. SQL Server için .NET Framework Veri Sağlayıcısı kullandığınızda, sağlayıcı bunu otomatik olarak yönettiği, ancak bazı ayarları değiştirebilseniz de bağlantı havuzunu etkinleştirmek zorunda değilsiniz.When you use the .NET Framework Data Provider for SQL Server, you do not have to enable connection pooling because the provider manages this automatically, although you can modify some settings. Daha fazla bilgi için bkz. SQL Server bağlantı havuzu (ADO.net).For more information, see SQL Server Connection Pooling (ADO.NET).
Bir, SqlException çalıştıran yöntemi tarafından oluşturulduysa, SqlCommand SqlConnection önem düzeyi 19 veya daha az olduğunda açık kalır.If a SqlException is generated by the method executing a SqlCommand, the SqlConnection remains open when the severity level is 19 or less. Önem düzeyi 20 veya daha büyükse, sunucu genellikle kapatır SqlConnection .When the severity level is 20 or greater, the server ordinarily closes the SqlConnection. Ancak, Kullanıcı bağlantıyı yeniden açabilir ve devam edebilir.However, the user can reopen the connection and continue.
Nesnenin bir örneğini oluşturan bir uygulama, SqlConnection tüm doğrudan ve dolaylı çağıranların, bildirime dayalı veya kesinlik temelli güvenlik taleplerini ayarlayarak koda yeterli izne sahip olmasını gerektirebilir.An application that creates an instance of the SqlConnection object can require all direct and indirect callers to have sufficient permission to the code by setting declarative or imperative security demands. SqlConnection nesnesini kullanarak güvenlik talepleri oluşturur SqlClientPermission .SqlConnection makes security demands using the SqlClientPermission object. Kullanıcılar, kendi kodunun nesnesini kullanarak yeterli izinlere sahip olduğunu doğrulayabilirler SqlClientPermissionAttribute .Users can verify that their code has sufficient permissions by using the SqlClientPermissionAttribute object. Kullanıcılar ve Yöneticiler, makinede, Kullanıcı ve kurumsal düzeylerde güvenlik ilkesini değiştirmek için Caspol.exe (kod erişimi güvenlik Ilkesi aracı) de kullanabilir.Users and administrators can also use the Caspol.exe (Code Access Security Policy Tool) to modify security policy at the machine, user, and enterprise levels. Daha fazla bilgi için bkz. .net 'Teki güvenlik.For more information, see Security in .NET. Güvenlik taleplerinin nasıl kullanılacağını gösteren bir örnek için bkz. Code Access Security and ADO.net.For an example demonstrating how to use security demands, see Code Access Security and ADO.NET.
Sunucudan uyarı ve bilgi iletilerini işleme hakkında daha fazla bilgi için bkz. bağlantı olayları.For more information about handling warning and informational messages from the server, see Connection Events. SQL Server altyapısı hataları ve hata iletileri hakkında daha fazla bilgi için bkz. veritabanı altyapısı olayları ve hataları.For more information about SQL Server engine errors and error messages, see Database Engine Events and Errors.
Dikkat
Paylaşılan bellek yerine TCP 'yi zorlayabilirsiniz.You can force TCP instead of shared memory. Bunu, bağlantı dizesindeki sunucu adına TCP: ' a önek olarak ekleyerek yapabilirsiniz veya localhost kullanabilirsiniz.You can do that by prefixing tcp: to the server name in the connection string or you can use localhost.
Oluşturucular
| SqlConnection() |
SqlConnection sınıfının yeni bir örneğini başlatır.Initializes a new instance of the SqlConnection class. |
| SqlConnection(String) |
SqlConnectionBağlantı dizesini içeren bir dize verildiğinde, sınıfın yeni bir örneğini başlatır.Initializes a new instance of the SqlConnection class when given a string that contains the connection string. |
| SqlConnection(String, SqlCredential) |
SqlConnectionBir bağlantı dizesi verilen, kullanmayan |
Özellikler
| AccessToken |
Bağlantının erişim belirtecini alır veya ayarlar.Gets or sets the access token for the connection. |
| CanRaiseEvents |
Bileşenin bir olay yapıp yapamayacağını gösteren bir değer alır.Gets a value indicating whether the component can raise an event. (Devralındığı yer: Component) |
| ClientConnectionId |
Deneme başarılı veya başarısız olsun etmeksizin bağımsız olarak en son bağlantı girişiminin bağlantı KIMLIĞI.The connection ID of the most recent connection attempt, regardless of whether the attempt succeeded or failed. |
| ColumnEncryptionKeyCacheTtl |
Always Encrypted özelliği için sütun şifreleme anahtarı önbelleğindeki sütun şifreleme anahtarı girdileri için yaşam süresi alır veya ayarlar.Gets or sets the time-to-live for column encryption key entries in the column encryption key cache for the Always Encrypted feature. Varsayılan değer 2 saattir.The default value is 2 hours. 0, hiç önbelleğe alma anlamına gelir.0 means no caching at all. |
| ColumnEncryptionQueryMetadataCacheEnabled |
Always Encrypted etkinleştirilmiş veritabanlarına karşı çalıştırılan parametreli sorgular için sorgu meta verileri önbelleğe almanın etkin olup olmadığını (true) veya olmadığını (false) gösteren bir değer alır veya ayarlar.Gets or sets a value that indicates whether query metadata caching is enabled (true) or not (false) for parameterized queries running against Always Encrypted enabled databases. Varsayılan değer true şeklindedir.The default value is true. |
| ColumnEncryptionTrustedMasterKeyPaths |
Bir veritabanı sunucusu için güvenilen anahtar yollarının bir listesini ayarlamanıza olanak sağlar.Allows you to set a list of trusted key paths for a database server. Uygulama sorgusu işlenirken, Sürücü listede olmayan bir anahtar yolu alır, sorgu başarısız olur.If while processing an application query the driver receives a key path that is not on the list, the query will fail. Bu özellik, güvenlik saldırılarına karşı güvenlik saldırılarına karşı daha fazla koruma sağlar. Bu, anahtar deposu kimlik bilgilerinin sızmasına yol açabilecek bir taklit SQL Server sahte anahtar yolları sağlar.This property provides additional protection against security attacks that involve a compromised SQL Server providing fake key paths, which may lead to leaking key store credentials. |
| ConnectionString |
SQL Server bir veritabanını açmak için kullanılan dizeyi alır veya ayarlar.Gets or sets the string used to open a SQL Server database. |
| ConnectionTimeout |
Denemeyi sonlandırıp bir hata oluşturmadan önce bir bağlantı kurmaya çalışırken beklenecek süreyi (saniye cinsinden) alır.Gets the time to wait (in seconds) while trying to establish a connection before terminating the attempt and generating an error. |
| Container |
Öğesini içeren öğesini alır IContainer Component .Gets the IContainer that contains the Component. (Devralındığı yer: Component) |
| Credential |
SqlCredentialBu bağlantı için nesneyi alır veya ayarlar.Gets or sets the SqlCredential object for this connection. |
| Credentials | |
| Database |
Bir bağlantı açıldıktan sonra kullanılacak geçerli veritabanının veya veritabanının adını alır.Gets the name of the current database or the database to be used after a connection is opened. |
| DataSource |
Bağlanılacak SQL Server örneğinin adını alır.Gets the name of the instance of SQL Server to which to connect. |
| DbProviderFactory |
DbProviderFactoryBunu için alır DbConnection .Gets the DbProviderFactory for this DbConnection. (Devralındığı yer: DbConnection) |
| DesignMode |
Şu anda Tasarım modunda olup olmadığını gösteren bir değer alır Component .Gets a value that indicates whether the Component is currently in design mode. (Devralındığı yer: Component) |
| Events |
Bu öğesine eklenen olay işleyicilerinin listesini alır Component .Gets the list of event handlers that are attached to this Component. (Devralındığı yer: Component) |
| FireInfoMessageEventOnUserErrors |
Özelliği alır veya ayarlar FireInfoMessageEventOnUserErrors .Gets or sets the FireInfoMessageEventOnUserErrors property. |
| PacketSize |
Bir SQL Server örneğiyle iletişim kurmak için kullanılan ağ paketlerinin boyutunu (bayt cinsinden) alır.Gets the size (in bytes) of network packets used to communicate with an instance of SQL Server. |
| ServerVersion |
İstemcinin bağlı olduğu SQL Server örneğinin sürümünü içeren bir dize alır.Gets a string that contains the version of the instance of SQL Server to which the client is connected. |
| Site |
Öğesini alır veya ayarlar ISite Component .Gets or sets the ISite of the Component. (Devralındığı yer: Component) |
| State |
SqlConnectionBağlantıda gerçekleştirilen en son ağ işlemi sırasında durumunu gösterir.Indicates the state of the SqlConnection during the most recent network operation performed on the connection. |
| StatisticsEnabled |
Olarak ayarlandığında |
| WorkstationId |
Veritabanı istemcisini tanımlayan bir dize alır.Gets a string that identifies the database client. |
Yöntemler
| BeginDbTransaction(IsolationLevel) |
Türetilmiş bir sınıfta geçersiz kılınırsa, bir veritabanı işlemi başlatır.When overridden in a derived class, starts a database transaction. (Devralındığı yer: DbConnection) |
| BeginDbTransactionAsync(IsolationLevel, CancellationToken) |
Zaman uyumsuz olarak bir veritabanı işlemi başlatır.Asynchronously starts a database transaction. (Devralındığı yer: DbConnection) |
| BeginTransaction() |
Bir veritabanı işlemi başlatır.Starts a database transaction. |
| BeginTransaction(IsolationLevel) |
Belirtilen yalıtım düzeyiyle bir veritabanı işlemi başlatır.Starts a database transaction with the specified isolation level. |
| BeginTransaction(IsolationLevel, String) |
Belirtilen yalıtım düzeyi ve işlem adına sahip bir veritabanı işlemi başlatır.Starts a database transaction with the specified isolation level and transaction name. |
| BeginTransaction(String) |
Belirtilen işlem adına sahip bir veritabanı işlemi başlatır.Starts a database transaction with the specified transaction name. |
| BeginTransactionAsync(CancellationToken) |
Zaman uyumsuz olarak bir veritabanı işlemi başlatır.Asynchronously begins a database transaction. (Devralındığı yer: DbConnection) |
| BeginTransactionAsync(IsolationLevel, CancellationToken) |
Zaman uyumsuz olarak bir veritabanı işlemi başlatır.Asynchronously begins a database transaction. (Devralındığı yer: DbConnection) |
| ChangeDatabase(String) |
Geçerli veritabanını açık olarak değiştirir SqlConnection .Changes the current database for an open SqlConnection. |
| ChangeDatabaseAsync(String, CancellationToken) |
Açık bir bağlantının geçerli veritabanını zaman uyumsuz olarak değiştirir.Asynchronously changes the current database for an open connection. (Devralındığı yer: DbConnection) |
| ChangePassword(String, SqlCredential, SecureString) |
Nesnede belirtilen kullanıcı için SQL Server parolasını değiştirir SqlCredential .Changes the SQL Server password for the user indicated in the SqlCredential object. |
| ChangePassword(String, String) |
Bağlantı dizesinde belirtilen kullanıcı için SQL Server parolasını sağlanan yeni parolaya dönüştürür.Changes the SQL Server password for the user indicated in the connection string to the supplied new password. |
| ClearAllPools() |
Bağlantı havuzunu boşaltır.Empties the connection pool. |
| ClearPool(SqlConnection) |
Belirtilen bağlantıyla ilişkili bağlantı havuzunu boşaltır.Empties the connection pool associated with the specified connection. |
| Close() |
Veritabanına bağlantıyı kapatır.Closes the connection to the database. Bu, herhangi bir açık bağlantıyı kapatmak için tercih edilen yöntemdir.This is the preferred method of closing any open connection. |
| CloseAsync() |
Veritabanı bağlantısını zaman uyumsuz olarak kapatır.Asynchronously closes the connection to the database. (Devralındığı yer: DbConnection) |
| CreateCommand() |
İle ilişkili bir nesnesi oluşturur ve döndürür SqlCommand SqlConnection .Creates and returns a SqlCommand object associated with the SqlConnection. |
| CreateDbCommand() |
Türetilmiş bir sınıfta geçersiz kılınırsa, DbCommand geçerli bağlantıyla ilişkili bir nesne oluşturur ve döndürür.When overridden in a derived class, creates and returns a DbCommand object associated with the current connection. (Devralındığı yer: DbConnection) |
| CreateObjRef(Type) |
Uzak bir nesneyle iletişim kurmak için kullanılan bir ara sunucu oluşturmak için gereken tüm bilgileri içeren bir nesne oluşturur.Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Devralındığı yer: MarshalByRefObject) |
| Dispose() |
Uygulama tarafından tanımlanan, yönetilmeyen kaynakları serbest bırakma, salma veya sıfırlama ile ilişkili görevleri gerçekleştirir.Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Devralındığı yer: DbConnection) |
| Dispose() |
Component tarafından kullanılan tüm kaynakları serbest bırakır.Releases all resources used by the Component. (Devralındığı yer: Component) |
| Dispose(Boolean) |
DbConnection tarafından kullanılan yönetilmeyen kaynakları serbest bırakır ve yönetilen kaynakları isteğe bağlı olarak serbest bırakır.Releases the unmanaged resources used by the DbConnection and optionally releases the managed resources. (Devralındığı yer: DbConnection) |
| Dispose(Boolean) |
Component tarafından kullanılan yönetilmeyen kaynakları serbest bırakır ve yönetilen kaynakları isteğe bağlı olarak serbest bırakır.Releases the unmanaged resources used by the Component and optionally releases the managed resources. (Devralındığı yer: Component) |
| DisposeAsync() |
Bağlantı nesnesini zaman uyumsuz olarak atar.Asynchronously diposes the connection object. (Devralındığı yer: DbConnection) |
| EnlistDistributedTransaction(ITransaction) |
Belirtilen işlemde bir dağıtılmış işlem olarak listeler.Enlists in the specified transaction as a distributed transaction. |
| EnlistTransaction(Transaction) |
Belirtilen işlemde bir dağıtılmış işlem olarak listeler.Enlists in the specified transaction as a distributed transaction. |
| EnlistTransaction(Transaction) |
Belirtilen işlemdeki listeler.Enlists in the specified transaction. (Devralındığı yer: DbConnection) |
| Equals(Object) |
Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.Determines whether the specified object is equal to the current object. (Devralındığı yer: Object) |
| GetHashCode() |
Varsayılan karma işlevi olarak işlev görür.Serves as the default hash function. (Devralındığı yer: Object) |
| GetLifetimeService() |
Kullanımdan kalktı.
Bu örnek için ömür ilkesini denetleyen geçerli ömür hizmeti nesnesini alır.Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Devralındığı yer: MarshalByRefObject) |
| GetSchema() |
Bunun veri kaynağı için şema bilgilerini döndürür SqlConnection .Returns schema information for the data source of this SqlConnection. Düzen hakkında daha fazla bilgi için bkz. SQL Server şema koleksiyonları.For more information about scheme, see SQL Server Schema Collections. |
| GetSchema() |
Bunun veri kaynağı için şema bilgilerini döndürür DbConnection .Returns schema information for the data source of this DbConnection. (Devralındığı yer: DbConnection) |
| GetSchema(String) |
SqlConnectionŞema adı için belirtilen dizeyi kullanarak bu veri kaynağı için şema bilgilerini döndürür.Returns schema information for the data source of this SqlConnection using the specified string for the schema name. |
| GetSchema(String) |
DbConnectionŞema adı için belirtilen dizeyi kullanarak bu veri kaynağı için şema bilgilerini döndürür.Returns schema information for the data source of this DbConnection using the specified string for the schema name. (Devralındığı yer: DbConnection) |
| GetSchema(String, String[]) |
SqlConnectionŞema adı için belirtilen dizeyi ve kısıtlama değerleri için belirtilen dize dizisini kullanarak bu değerin veri kaynağı için şema bilgilerini döndürür.Returns schema information for the data source of this SqlConnection using the specified string for the schema name and the specified string array for the restriction values. |
| GetSchema(String, String[]) |
DbConnectionŞema adı için belirtilen dizeyi ve kısıtlama değerleri için belirtilen dize dizisini kullanarak bu değerin veri kaynağı için şema bilgilerini döndürür.Returns schema information for the data source of this DbConnection using the specified string for the schema name and the specified string array for the restriction values. (Devralındığı yer: DbConnection) |
| GetSchemaAsync(CancellationToken) |
Bu, öğesinin zaman uyumsuz bir sürümüdür GetSchema() .This is an asynchronous version of GetSchema().
Sağlayıcılar uygun bir uygulamayla geçersiz kılmalıdır.Providers should override with an appropriate implementation.
|
| GetSchemaAsync(String, CancellationToken) |
Bu, öğesinin zaman uyumsuz sürümüdür GetSchema(String) .This is the asynchronous version of GetSchema(String).
Sağlayıcılar uygun bir uygulamayla geçersiz kılmalıdır.Providers should override with an appropriate implementation.
|
| GetSchemaAsync(String, String[], CancellationToken) |
Bu, öğesinin zaman uyumsuz sürümüdür GetSchema(String, String[]) .This is the asynchronous version of GetSchema(String, String[]).
Sağlayıcılar uygun bir uygulamayla geçersiz kılmalıdır.Providers should override with an appropriate implementation.
|
| GetService(Type) |
Veya tarafından belirtilen bir hizmeti temsil eden bir nesne döndürür Component Container .Returns an object that represents a service provided by the Component or by its Container. (Devralındığı yer: Component) |
| GetType() |
TypeGeçerli örneği alır.Gets the Type of the current instance. (Devralındığı yer: Object) |
| InitializeLifetimeService() |
Kullanımdan kalktı.
Bu örnek için ömür ilkesini denetlemek üzere bir ömür hizmeti nesnesi alır.Obtains a lifetime service object to control the lifetime policy for this instance. (Devralındığı yer: MarshalByRefObject) |
| MemberwiseClone() |
Geçerli bir basit kopyasını oluşturur Object .Creates a shallow copy of the current Object. (Devralındığı yer: Object) |
| MemberwiseClone(Boolean) |
Geçerli nesnenin basit bir kopyasını oluşturur MarshalByRefObject .Creates a shallow copy of the current MarshalByRefObject object. (Devralındığı yer: MarshalByRefObject) |
| OnStateChange(StateChangeEventArgs) |
Olayını oluşturur StateChange .Raises the StateChange event. (Devralındığı yer: DbConnection) |
| Open() |
Tarafından belirtilen özellik ayarlarına sahip bir veritabanı bağlantısı açar ConnectionString .Opens a database connection with the property settings specified by the ConnectionString. |
| OpenAsync() |
Open()Tarafından belirtilen ayarlarla bir veritabanı bağlantısı açan zaman uyumsuz bir sürümü ConnectionString .An asynchronous version of Open(), which opens a database connection with the settings specified by the ConnectionString. Bu yöntem, OpenAsync(CancellationToken) CancellationToken. None ile sanal yöntemi çağırır.This method invokes the virtual method OpenAsync(CancellationToken) with CancellationToken.None. (Devralındığı yer: DbConnection) |
| OpenAsync(CancellationToken) |
Open()Tarafından belirtilen özellik ayarlarıyla bir veritabanı bağlantısı açan zaman uyumsuz bir sürümü ConnectionString .An asynchronous version of Open(), which opens a database connection with the property settings specified by the ConnectionString. İptal belirteci, bağlantı zaman aşımı sona erdiğinde işlemin terk edilmesini istemek için kullanılabilir.The cancellation token can be used to request that the operation be abandoned before the connection timeout elapses. Özel durumlar döndürülen görev aracılığıyla yayılacaktır.Exceptions will be propagated via the returned Task. Bağlantı zaman aşımı süresi başarıyla bağlantı olmadan geçtiğinde, döndürülen görev bir özel durumla hatalı olarak işaretlenir.If the connection timeout time elapses without successfully connecting, the returned Task will be marked as faulted with an Exception. Uygulama, hem havuza alınmış hem de havuza alınmamış bağlantılar için çağıran iş parçacığını engellemeden bir görev döndürür.The implementation returns a Task without blocking the calling thread for both pooled and non-pooled connections. |
| OpenAsync(CancellationToken) |
Bu, öğesinin zaman uyumsuz sürümüdür Open() .This is the asynchronous version of Open(). Sağlayıcılar uygun bir uygulamayla geçersiz kılmalıdır.Providers should override with an appropriate implementation. İptal belirteci isteğe bağlı olarak kabul edilebilir.The cancellation token can optionally be honored. Varsayılan uygulama, zaman uyumlu Open() aramayı çağırır ve tamamlanan bir görev döndürür.The default implementation invokes the synchronous Open() call and returns a completed task. Zaten iptal edilmiş bir cancellationToken geçirildiğinde varsayılan uygulama iptal edilen bir görev döndürür.The default implementation will return a cancelled task if passed an already cancelled cancellationToken. Open tarafından oluşturulan özel durumlar, döndürülen görev özel durumu özelliği aracılığıyla iletilecektir.Exceptions thrown by Open will be communicated via the returned Task Exception property. Döndürülen görev tamamlanana kadar nesnenin diğer yöntemlerini ve özelliklerini çağırmayın |
| RegisterColumnEncryptionKeyStoreProviders(IDictionary<String,SqlColumnEncryptionKeyStoreProvider>) |
Sütun şifreleme anahtarı deposu sağlayıcılarını kaydeder.Registers the column encryption key store providers. |
| ResetStatistics() |
İstatistik toplama etkinse, tüm değerler sıfıra sıfırlanır.If statistics gathering is enabled, all values are reset to zero. |
| RetrieveStatistics() |
Metodun çağrıldığı zaman içinde istatistiklerin bir ad değeri çifti koleksiyonunu döndürür.Returns a name value pair collection of statistics at the point in time the method is called. |
| ToString() |
Geçerli nesneyi temsil eden dizeyi döndürür.Returns a string that represents the current object. (Devralındığı yer: Object) |
| ToString() |
Varsa, String varsa adını içeren bir döndürür Component .Returns a String containing the name of the Component, if any. Bu yöntem geçersiz kılınmamalıdır.This method should not be overridden. (Devralındığı yer: Component) |
Ekinlikler
| Disposed |
Bileşen yönteme bir çağrı tarafından bırakıldığında gerçekleşir Dispose() .Occurs when the component is disposed by a call to the Dispose() method. (Devralındığı yer: Component) |
| InfoMessage |
SQL Server bir uyarı veya bilgi iletisi döndürdüğünde gerçekleşir.Occurs when SQL Server returns a warning or informational message. |
| StateChange |
Bağlantının durumu değiştiğinde gerçekleşir.Occurs when the state of the connection changes. |
| StateChange |
Bağlantının durumu değiştiğinde gerçekleşir.Occurs when the state of the connection changes. (Devralındığı yer: DbConnection) |
Belirtik Arabirim Kullanımları
| ICloneable.Clone() |
Geçerli örneğin kopyası olan yeni bir nesne oluşturur.Creates a new object that is a copy of the current instance. |
| IDbConnection.BeginTransaction() |
Bir veritabanı işlemi başlatır.Begins a database transaction. |
| IDbConnection.BeginTransaction() |
Bir veritabanı işlemi başlatır.Begins a database transaction. (Devralındığı yer: DbConnection) |
| IDbConnection.BeginTransaction(IsolationLevel) |
Belirtilen değere sahip bir veritabanı işlemi başlatır IsolationLevel .Begins a database transaction with the specified IsolationLevel value. |
| IDbConnection.BeginTransaction(IsolationLevel) |
Belirtilen yalıtım düzeyine sahip bir veritabanı işlemi başlatır.Begins a database transaction with the specified isolation level. (Devralındığı yer: DbConnection) |
| IDbConnection.CreateCommand() |
Bağlantıyla ilişkili bir komut nesnesi oluşturur ve döndürür.Creates and returns a Command object that is associated with the connection. |
| IDbConnection.CreateCommand() |
DbCommandGeçerli bağlantıyla ilişkili bir nesne oluşturur ve döndürür.Creates and returns a DbCommand object that is associated with the current connection. (Devralındığı yer: DbConnection) |