using System;
using System.Data;
using System.Data.OleDb;
class DataSetDataAdapter
{
static void Main(string[] args)
{
string ConStr = ("Provider=MSDAORA;data source=bitcamp2;User ID=scott;Password=tiger");
OleDbConnection Conn = new OleDbConnection(ConStr);
OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM addrbook", Conn);
DataTable dt = new DataTable("주소록");
int a = da.Fill(dt);
foreach(DataRow r in dt.Rows)
{
Console.WriteLine("ID: \t{0}", r["Name"] );
Console.WriteLine("Name: \t{0}", r["Tel"]);
}
Console.WriteLine("\n\n");
Console.WriteLine("Affected Row : {0}", a);
}
}
댓글 없음:
댓글 쓰기