Đang chuẩn bị liên kết để tải về tài liệu:
Creating a SqlCommand Object

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Use one of the SqlCommand constructors. Call the CreateCommand() method of a SqlConnection object | Creating a SqlCommand Object There are two ways you can create a SqlCommand object Use one of the SqlCommand constructors. Call the CreateCommand method of a SqlConnection object. You ll see how to use both these ways to create SqlCommand objects next. Note You can use the same ways shown in the following sections to create an OleDbCommand or OdbcCommand object. Creating a SqlCommand Object Using a Constructor The SqlCommand constructors are as follows SqlCommand SqlCommand string commandText SqlCommand string commandText SqlConnection mySqlConnection SqlCommand string commandText SqlConnection mySqlConnection SqlTransaction mySqlTransaction where commandText contains your SQL statement stored procedure call or table to retrieve from. mySqlConnection is your SqlConnection object. mySqlTransaction is your SqlTransaction object. Before you use a SqlCommand object you first need a SqlConnection object which is used to communicate with a SQL Server database mySqlConnection.ConnectionString server localhost database Northwind uid sa pwd sa Next you can create a new SqlCommand object using the following statement SqlCommand mySqlCommand new SqlCommand You then set the Connection property of mySqlCommand to mySqlConnection mySqlCommand.Connection mySqlConnection The mySqlCommand object will then use mySqlConnection to communicate with the database. Now the CommandType property of a Connection object determines the type of command to be executed. You can use any of the values in the System.Data.CommandType enumeration to specify the CommandType property. Table 8.3 shows the CommandType enumeration values. Table 8.3 CommandType ENUMERATION VALUES VALUE DESCRIPTION Text Indicates the command is a SQL statement. Text is the default. StoredProcedure Indicates the command is a stored procedure call. TableDirect Indicates the name of a table for which all rows and columns are to be retrieved. Note SqlCommand objects don t support TableDirect. You have to use an object of one of

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.