참고하세요~
간단한 콘솔 애플리케이션 입니다.
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/자바/스프링/안드로이드/닷넷C#/웹퍼블… | 12-27 | 2437 | ||
[채용확정무료교육]오라클자바개발잘하는신입뽑기2개월과정,교육… | 12-11 | 1788 | ||
53 | [평일100%환급7건]Spring,자바&JSP,안드로이드,웹퍼블리싱,C#닷… | 03-15 | 1599 | |
52 | [주말]C#,ASP.NET마스터 | 01-31 | 1692 | |
51 | [기업100%환급,평일주간]SQL기초에서스키마오브젝트,PLSQL,힌트… | 01-31 | 2319 | |
50 | [평일주간야간,주말]C기본&자료구조,알고리즘 | 01-31 | 1335 | |
49 | [평일주간,평일야간,주말]Spring,MyBatis,Hibernate개발자과정-… | 01-19 | 1644 | |
48 | [평일야간,주말]안드로이드개발자과정(Android기초실무) | 01-11 | 1500 | |
47 | [평일야간,주말주간야간]JAVA,Network&JSP&Spring,MyBatis,Hiber… | 01-03 | 2029 | |
46 | [개발실무&100%환급]SQL/자바/스프링/안드로이드/닷넷C#/웹퍼블… | 12-27 | 2437 | |
45 | [기업100%환급,평일주간5일 교육]JAVA,JDBC,Servlet,JSP | 12-19 | 1755 | |
44 | [평일주간야간, 주말]웹퍼블리싱 마스터(HTML5,CSS3,jQUERY,AJAX… | 12-14 | 1731 | |
43 | [채용확정무료교육]오라클자바개발잘하는신입뽑기2개월과정,교육… | 12-11 | 1788 | |
42 | [기업100%환급]웹퍼블리싱마스터(HTML5,CSS3,JavaScript,jQUERY) | 12-09 | 1403 | |
41 | [평일야간]닷넷(C#,Network,ADO.NET,ASP.NET)마스터 | 12-01 | 1631 | |
40 | [기업100%환급]오라클&자바웹스프링신입과정3주(SQL,JAVA,JSP,Se… | 12-01 | 1806 | |
39 | [평일야간,주말]SQL기초에서실무까지(SQL기초,PLSQL,힌트,튜닝) | 12-01 | 1280 |
댓글 없음:
댓글 쓰기