Professional ASP.NET 3.5 in C# and Visual Basic Part 44

Professional in C# and Visual Basic Part 44. Building on the revolutionary release, adds several key new developer features including AJAX, LINQ, and a new CSS designer in Visual Web Developer 2008. The dramatic reduction in code that developers realized from the more than 50 new server controls in now allows developers the time to make their applications more interactive with AJAX, to work with data in their preferred language with LINQ, and to build visually attractive and consistent standards-based sites with CSS. . | Chapter 8 Data Managementwith For this line of code to work you are going to have to make a reference to the namespace. When you complete your connection to the data source be sure that you close the connection by using . The .NET Framework does not implicitly release the connections when they fall out of scope. Using the Command Object The Command object uses the Connection object to execute SQL queries. These queries can be in the form of inline text stored procedures or direct table access. If the SQL query uses a select clause the result set it returns is usually stored in either a DataSet or a DataReader object. The Command object provides a number of Execute methods that can be used to perform various types of SQL queries. Next take a look at some of the more useful properties of the SqlCommand class as shown in the following table. Property Description CommandText This read write property allows you to set or retrieve either the T-SQL statement or the name of the stored procedure. CommandTimeout This read write property gets or sets the number of seconds to wait while attempting to execute a particular command. The command is aborted after it times out and an exception is thrown. The default time allotted for this operation is 30 seconds. CommandType This read write property indicates the way the CommandTextproperty should be interpreted. The possible values are StoredProcedure TableDirect and Text. The value of Text means that your SQL statement is inline or contained within the code itself. Connection This read write property gets or sets the SqlConnection object that should be used by this Command object. Next take a look at the various Execute methods that can be called from a Command object. Property Description ExecuteNonQuery This method executes the command specified and returns the number of rows affected. ExecuteReader This method executes the command specified and returns an instance of the SqlDataReader .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã 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.