OracleCommandbuilder

xiaoxiao2021-03-06  66

Public Static Void BuilderUpdate (String Cnstr) {String Cmdstr = "SELECT EMPNO, Empname, JobDescription from Empinfo";

// Create the adapter with the selectcommand txt and the // connection stringoracledataadapter Adapter = New OracleDataAdapter (cmdstr, connStr);

// Get the connection from the adapteroraclectConnection connection = adapter.selectCommand.connection;

// Create The Builder for the adapter to automatic or generate // The Command When NeedoCaleCommandBuilder Builder = New OracleCommandBuilder;

// Create and fill the dataset using the EmpinfodataSet DataSet = New DataSet ();

Adapter.Fill (DataSet, "Empinfo");

// Get the Empinfo Table from The DatasetDataTable Table = Dataset.tables ["Empinfo"];

// Get the first row from the Empinfo TableDataRow Row0 = Table.Rows [0];

// Update the Job description in the first rowrow0 ["jobdescription"] = "manager";

// Now update the EMPINFO using the adapter, the job description // of 'KING' is changed to 'MANAGER' // The OracleCommandBuilder will create the UpdateCommand for the // adapter to update the EMPINFO tableadapter.Update (dataset, "EMPINFO ");

转载请注明原文地址:https://www.9cbs.com/read-90540.html

New Post(0)