TAILIEUCHUNG - Overcoming Keyword Conflicts When Using CommandBuilders

[ Team LiB ] Recipe Overcoming Keyword Conflicts When Using CommandBuilders Problem Your data includes table and column names that conflict with SQL keywords. You can overcome this with brackets or quotes in SELECT statements that you write, but the CommandBuilder creates illegal update statements. | Team LiB Recipe Overcoming Keyword Conflicts When Using CommandBuilders Problem Your data includes table and column names that conflict with SQL keywords. You can overcome this with brackets or quotes in SELECT statements that you write but the CommandBuilder creates illegal update statements. You need to know how to use the CommandBuilder with your data. Solution Use the QuotePrefix and QuoteSuffix properties of the CommandBuilder object to delimit database server object names containing spaces or other illegal characters. The sample code contains two event handlers Preview Displays the delete insert and update commands using the delimiters specified by the user for the QuotePrefix and QuoteSuffix properties and either the OLE DB or SQL Server data provider as specified by the user. Retrieve OLE DB Uses the GetOleDbSchemaTable method of the OleDbConnection object to retrieve the default prefix and suffix delimiters for the data source. The C code is shown in Example 4-33. Example 4-33. File Namespaces variables and constants using System using using using using . . . private void previewButton_Click object sender e String sqlText SELECT OrderlD ProductID Quantity UnitPrice Discount FROM Order Details if Build the DataAdapter and the CommandBuilder. OleDbDataAdapter da new OleDbDataAdapter sqlText OleDb_ConnectString OleDbCommandBuilder cb new OleDbCommandBuilder da Set the prefix and suffix. Display CommandBuilder commands with the prefix and suffix. DeleteCommand .CommandText InsertCommand .CommandText UpdateCommand

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.