Reading and Writing Binary Data with Oracle

[ Team LiB ] Recipe Reading and Writing Binary Data with Oracle Problem You need to read and write binary data from and to an Oracle database. Solution Use the techniques shown in the following example. The sample code contains two event handlers | Team LiB Recipe Reading and Writing Binary Data with Oracle Problem You need to read and write binary data from and to an Oracle database. Solution Use the techniques shown in the following example. The sample code contains two event handlers Read Clears the controls on the form and builds a SQL statement to get the record for the specified ID from the Oracle table TBL0912. A connection is created and a command is built using the SQL statement and executed to build a DataReader. The BLOB is retrieved from the DataReader and displayed in the PictureBox on the form. The CLOB and NCLOB values are retrieved from the DataReader and displayed in text boxes on the form. Write Gets the ID from the TextBox on the form. A BLOB is retrieved from a user-specified file and loaded into a Byte array. An Oracle DataAdapter is created and a new table is created using the FillSchema command. A CommandBuilder is created from the DataAdapter. A new row is created where the BLOB value is set from the file specified by the user and the CLOB and NCLOB values are set from the text boxes on the form. The new row is added to the table and the data updated back to the source. The C code is shown in Example 9-15. Example 9-15. File Namespaces variables and constants using System using using using using using using using private OpenFileDialog ofd private const String TABLENAME TBL0912 private const String ID_FIELD ID private const String BLOBFIELD_FIELD BLOBFIELD private const String CLOBFIELD_FIELD CLOBFIELD private const String NCLOBFIELD_FIELD NCLOBFIELD . . . private void readButton_Click object sender e Clear the controls. null String sqlText SELECT FROM TABLENAME WHERE ID Create the connection and command. .

Không thể tạo bản xem trước, hãy bấm tải xuống
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.