using System;
using System
using System
namespace ConsoleDataSet
{
/// <summary>
/// Class
/// </summary>
class DataSetClass
{
/// <summary>
/// 應用程序的主入口點
/// </summary>
[STAThread]
static void Main(string[] args)
{
string strCon = @
// 定義連接
OleDbConnection MyCon = new OleDbConnection(strCon);
try
{
// 打開連接
MyCon
string strSQL = @
OleDbDataAdapter MyDataAdapter = new OleDbDataAdapter();
MyDataAdapter
// 將數據填充到DataSet中
DataSet MyDataSet = new DataSet();
MyDataAdapter
// 從DataSet中獲取DataTable
DataTable MyDataTable = MyDataSet
// 設置
MyDataTable
// 修改第一行的姓名
MyDataTable
MyDataTable
// 添加一條新記錄
DataRow NewRow = MyDataTable
NewRow[
NewRow[
MyDataTable
foreach (DataRow row in MyDataTable
{
Console
}
// 將DataSet中的數據更新到數據庫中
OleDbCommandBuilder MyCommandBuilder = new OleDbCommandBuilder(MyDataAdapter);
MyDataAdapter
}
catch (Exception ex)
{
Console
}
finally
{
MyCon
}
Console
}
}
}
From:http://tw.wingwit.com/Article/program/net/201311/11744.html