Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Sức khỏe - Y tế
Văn bản luật
Nông Lâm Ngư
Kỹ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Giới thiệu
Đăng ký
Đăng nhập
Tìm
Danh mục
Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Y tế sức khỏe
Văn bản luật
Nông lâm ngư
Kĩ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Thông tin
Điều khoản sử dụng
Quy định bảo mật
Quy chế hoạt động
Chính sách bản quyền
Giới thiệu
Đăng ký
Đăng nhập
0
Trang chủ
Công Nghệ Thông Tin
Kỹ thuật lập trình
Executing SELECT Statements and TableDirect Commands phần 1
Đang chuẩn bị liên kết để tải về tài liệu:
Executing SELECT Statements and TableDirect Commands phần 1
Duy Cường
41
10
pdf
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Executing SELECT Statements and TableDirect Commands A TableDirect command is actually a SELECT statement that returns all the rows and columns for a specified table. | Executing SELECT Statements and TableDirect Commands A TableDirect command is actually a SELECT statement that returns all the rows and columns for a specified table. A Command object has three methods you can use to execute a SELECT statement or TableDirect command. Table 8.4 shows these methods which you ll learn how to use in the following sections. Table 8.4 METHODS THAT RETRIEVE INFORMATION FROM THE DATABASE METHOD RETURN TYPE DESCRIPTION ExecuteReader SqlDataReader Used to execute SQL SELECT statements TableDirect commands or stored procedure calls that return a result set. Returns the result set in a DataReader object. ExecuteScalar object Used to execute SQL SELECT statements that return a single value any other values are ignored . Returns the single value as an object. ExecuteXmlReader XmlReader Used to execute SQL SELECT statements that return XML data. Returns the result set in an XmlReader object. Applies only to the SqlCommand class. Executing a SELECT Statement Using the ExecuteReader Method Let s take a look at an example that executes a SELECT statement using the ExecuteReader method. This method returns the result set in a DataReader object which you can then use to read the rows returned by the database. For example the following code creates the required objects and executes a SELECT statement that retrieves the top five rows from the Customers table SqlConnection mySqlConnection new SqlConnection server localhost database Northwind uid sa pwd sa SqlCommand mySqlCommand mySqlConnection.CreateCommand mySqlCommand.CommandText SELECT TOP 5 CustomerlD CompanyName ContactName Address FROM Customers ORDER BY CustomerlD mySqlConnection.Open SqlDataReader mySqlDataReader mySqlCommand.ExecuteReader Tip You ll notice that I didn t call the Open method of the SqlConnection object until just before calling the ExecuteReader method of the SqlCommand object. This is intentional. By opening the connection at the very last moment you minimize time spent .
TÀI LIỆU LIÊN QUAN
Executing SELECT Statements and TableDirect Commands phần 1
Executing SELECT Statements and TableDirect Commands phần 2
crossorigin="anonymous">
Đã 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.