using System;
using System
using System
namespace ConsoleCommandDemo
{
/// <summary>
/// Class
/// </summary>
class CommandClass
{
/// <summary>
/// 應用程序的主入口點
/// </summary>
[STAThread]
static void Main(string[] args)
{
string strCon = @
// 定義連接
OleDbConnection MyCon = new OleDbConnection(strCon);
try
{
MyCon
string strSQL = @
OleDbCommand MyCom = new OleDbCommand(strSQL
// 執行沒有返回結果的指令
Console
Console
// 刪除一條記錄
strSQL = @
MyCom
Console
Console
// 使用參數插入一條記錄
MyCom
MyCom
MyCom
MyCom
MyCom
Console
Console
// 刪除一條記錄
strSQL = @
MyCom
Console
Console
// 浏覽數據
strSQL = @
MyCom
OleDbDataReader MyDataReader = MyCom
// 顯示數據庫中的數據
Console
while(MyDataReader
{
Console
}
MyDataReader
}
catch (Exception ex)
{
Console
}
finally
{
MyCon
MyCon
}
Console
}
}
}
From:http://tw.wingwit.com/Article/program/net/201311/11905.html