1. Trang chủ
  2. » Công Nghệ Thông Tin

Understanding the SqlConnection Class

2 330 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Understanding the SqlConnection Class
Thể loại Chapter
Định dạng
Số trang 2
Dung lượng 20,24 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Understanding the SqlConnection Class You use an object of the SqlConnection class to connect to a SQL Server database, and this object handles the communication between the database and

Trang 1

Understanding the SqlConnection Class

You use an object of the SqlConnection class to connect to a SQL Server database, and this object handles the communication between the database and your C# program

Note Although the SqlConnection class is specific to SQL Server, many of the properties, methods, and events in this class are the same as those for the OleDbConnection and OdbcConnection classes If a property or method is specific to SqlConnection,

it says so in the Description column of the tables shown in this section You can look up the exact properties, methods, and events for a specific class using the NET

Programming with ADO.NET."

Table 7.1: SqlConnection PROPERTIES

PROPERTY TYPE DESCRIPTION

establish a connection to a database The default is

15 seconds

database to be used once the connection to the database is made)

communicate with SQL Server This property applies only to the SqlConnection class The default is 8,192 bytes

Closed, Connecting, Executing, Fetching, or Open These states are covered later in the "Getting the State of a Connection" section

is connected to SQL Server This property applies only to the SqlConnection class

Trang 2

Table 7.2 shows some of the SqlConnection methods

Table 7.2: SqlConnection METHODS

METHOD RETURN

TYPE

DESCRIPTION

BeginTransaction() SqlTransaction Overloaded Begins a database transaction

connection

CreateCommand() SqlCommand Creates and returns a command object

settings specified by the ConnectionString property

You can use events to allow one object to notify another object that something has

occurred For example, when you click a mouse button in a Windows application, an

Table 7.3: SqlConnection EVENTS

EVENT EVENT HANDLER DESCRIPTION

changed

InfoMessage SqlInfoMessageEventHandler Fires when the database returns a warning or

information message

You'll learn how to use some of these properties, methods, and events in the following sections

Ngày đăng: 28/10/2013, 16:15

TỪ KHÓA LIÊN QUAN