tailieunhanh - ODP .NET Developer's Guide oracle database 10g development with visual studio 2005 phần 4

Creating an Oracle Table Dynamically Using - Bạn có thể làm việc với hầu như bất kỳ lệnh DDL bằng cách sử dụng cùng một phương pháp bạn đã sử dụng trước đó tức là ExecuteNonQuery với OracleCommand. Chúng tôi chỉ có thể thay thế DML lệnh chúng tôi sử dụng trước đó với một lệnh DDL. Ví dụ sau đây tạo ra một bảng trong cơ sở dữ liệu | Chapter 4 Creating an Oracle Table Dynamically Using You can work with almost any DDL command using the same method you used previously . ExecuteNonQuery with OracleCommand. We can just replace the DML command we used earlier with a DDL command. The following example creates a table in Oracle database dynamically from within .NET Private Sub btnCreateTable_Click ByVal sender As ByVal e As Handles create connection to db Dim cn As New OracleConnection Data Source xe _ User Id scott Password tiger Try Dim SQL As String build the CREATE TABLE statement Dim sb As New CREATE TABLE MyEmp empno NUMBER 4 ename VARCHAR2 20 SQL create command object Dim cmd As New OracleCommand SQL cn open the connection execute the DDL command close the connection display the result Succesfully created Catch ex As Exception display if any error occurs Error close the connection if it is still open If Then End If End Try End Sub 81 Manipulating Data in Oracle Using Updating Offline Data to the Database Using OracleDataAdapter When you use OracleDataAdapter you will generally fill information into either a dataset or data table. A dataset or data table resides in client memory offline without having any connection to Oracle database. You can make changes to the data available at the client in offline mode and finally update all of those modifications to the database using the Update method of OracleDataAdapter. The following is a demonstration which adds a new row to a data table in offline mode and later updates it to the database using the Update method Private Sub btnDatasetUpdate_Click ByVal sender As ByVal e As Handles create connection .

TỪ KHÓA LIÊN QUAN