참고하세요~
간단한 콘솔 애플리케이션 입니다.
using System;
using System.Data;
using System.Data.OleDb;
using System.Data;
using System.Data.OleDb;
class DatasetExample
{
public static void Main()
{
OLEDB();
}
{
public static void Main()
{
OLEDB();
}
public static void OLEDB()
{
//아래 Data Source는 oracle설치 폴더 network/admin/tnsnames.ora 파일에 있는 접속을 원하는 DB의 별명 입니다.,
string cnString = @"Provider=MSDORA;data source=onj;User ID=scott;Password=tiger";
OleDbConnection OleCn = new OleDbConnection(cnString);
OleCn.Open();
OleCn.Open();
string sql = "SELECT * FROM emp";
try
{
OleDbCommand OleCmd = new OleDbCommand(sql, OleCn);
OleDbDataAdapter OleDa = new OleDbDataAdapter(OleCmd);
{
OleDbCommand OleCmd = new OleDbCommand(sql, OleCn);
OleDbDataAdapter OleDa = new OleDbDataAdapter(OleCmd);
DataSet ds = new DataSet();
OleDa.Fill(ds, "EMP");
OleCn.Close();
OleCn.Close();
DataTable dt = ds.Tables["EMP"];
Console.Write("\n\n");
Console.Write("\n\n");
foreach (DataColumn hdr in dt.Columns)
{
Console.Write("{0, -10}\t", hdr.ColumnName);
}
Console.WriteLine("\n---------------------------------------------------");
{
Console.Write("{0, -10}\t", hdr.ColumnName);
}
Console.WriteLine("\n---------------------------------------------------");
foreach (DataRow dtr in dt.Rows)
{
foreach (DataColumn dtc in dt.Columns)
{
Console.Write("{0, -10}", dtr[dtc.ColumnName].ToString().Trim());
Console.Write("\t");
}
Console.Write("\n");
}
}
catch (Exception e)
{
Console.WriteLine("Error: " + e);
}
}
}
[결과]
[100%환급,개발자전문]빅데이터/SQL/자바/스프링/안드로이드/닷… | 12-27 | 2614 | ||
[채용확정무료교육]오라클자바개발잘하는신입뽑기2개월과정,교육… | 12-11 | 1890 | ||
53 | [평일100%환급7건]Spring,자바&JSP,안드로이드,웹퍼블리싱,C#닷… | 03-15 | 1706 | |
52 | [주말]C#,ASP.NET마스터 | 01-31 | 1813 | |
51 | [기업100%환급,평일주간]SQL기초에서스키마오브젝트,PLSQL,힌트… | 01-31 | 2660 | |
50 | [평일주간야간,주말]C기본&자료구조,알고리즘 | 01-31 | 1422 | |
49 | [평일주간,평일야간,주말]Spring,MyBatis,Hibernate개발자과정-… | 01-19 | 1741 | |
48 | [평일야간,주말]안드로이드개발자과정(Android기초실무) | 01-11 | 1631 | |
47 | [평일야간,주말주간야간]JAVA,Network&JSP&Spring,MyBatis,Hiber… | 01-03 | 2150 | |
46 | [100%환급,개발자전문]빅데이터/SQL/자바/스프링/안드로이드/닷… | 12-27 | 2614 | |
45 | [평일주간]NoSQL,MongoDB,빅데이터기초과정 | 12-19 | 1856 | |
44 | [평일주간야간, 주말]웹퍼블리싱 마스터(HTML5,CSS3,jQUERY,AJAX… | 12-14 | 1826 | |
43 | [채용확정무료교육]오라클자바개발잘하는신입뽑기2개월과정,교육… | 12-11 | 1890 | |
42 | [평일주간]빅데이터하둡기초과정(BigData Hadoop) | 12-09 | 1483 | |
41 | [평일야간]닷넷(C#,Network,ADO.NET,ASP.NET)마스터 | 12-01 | 1715 | |
40 | [기업100%환급]오라클&자바웹스프링신입과정3주(SQL,JAVA,JSP,Se… | 12-01 | 1887 | |
39 | [평일야간,주말]SQL기초에서실무까지(SQL기초,PLSQL,힌트,튜닝) | 12-01 | 1359 |
댓글 없음:
댓글 쓰기