//OLEDB를 이용 한 예제 입니다.
//Visual Studio .Net에서 C#, 윈도우 프로그래을 선택한 후 실행해 보세요
//결과는 화면에 윈도우가 나타 나면서 그안에 EMP Table의 내용이 나오는 겁니다.
using System.Data.OleDb; //for OleDbConnection, OleDbCommand , etc
using System.Data; //for DataSet
using System.Windows.Forms; //DataGrid, Form
using System; //for String
class GridForm : Form
{
private DataGrid dataGrid1 ;
public GridForm()
{
AutoScaleBaseSize = new System.Drawing.Size(6, 14);
ClientSize = new System.Drawing.Size(544, 342);
Load += new System.EventHandler(this.Form1_Load);
dataGrid1 = new DataGrid();
dataGrid1.Name = "dataGrid1";
dataGrid1.Size = new System.Drawing.Size(520, 312);
Controls.Add(this.dataGrid1);
}
OleDbConnection Conn;
OleDbCommand myCommand;
DataSet myDataSet;
OleDbDataAdapter myAdapter;
private void Form1_Load(object sender, System.EventArgs e)
{
try
{
//-------------------------------------------------------------------------------
//아래는 오라클용 접속 문자열, wink는 net service 이름
//-------------------------------------------------------------------------------
string ConStr = ("Provider=MSDAORA;data source=wink;User ID=scott;Password=tiger");
Conn = new OleDbConnection(ConStr);
Conn.Open();
String sql = "select * from emp ";
myCommand = new OleDbCommand(sql, Conn);
myAdapter = new OleDbDataAdapter();
myCommand.CommandType = CommandType.Text ;
myAdapter.SelectCommand = myCommand;
myDataSet = new DataSet();
myAdapter.Fill(myDataSet, "emp");
dataGrid1.DataSource = myDataSet;
dataGrid1.DataMember = "emp";
}
catch(Exception ex)
{
MessageBox.Show(ex.Message, "emp Table Loading");
}
finally
{
Conn.Close();
}
}
}
class Displayform
{
static void Main()
{
System.Windows.Forms.Application.Run(new GridForm());
}
}
//Visual Studio .Net에서 C#, 윈도우 프로그래을 선택한 후 실행해 보세요
//결과는 화면에 윈도우가 나타 나면서 그안에 EMP Table의 내용이 나오는 겁니다.
using System.Data.OleDb; //for OleDbConnection, OleDbCommand , etc
using System.Data; //for DataSet
using System.Windows.Forms; //DataGrid, Form
using System; //for String
class GridForm : Form
{
private DataGrid dataGrid1 ;
public GridForm()
{
AutoScaleBaseSize = new System.Drawing.Size(6, 14);
ClientSize = new System.Drawing.Size(544, 342);
Load += new System.EventHandler(this.Form1_Load);
dataGrid1 = new DataGrid();
dataGrid1.Name = "dataGrid1";
dataGrid1.Size = new System.Drawing.Size(520, 312);
Controls.Add(this.dataGrid1);
}
OleDbConnection Conn;
OleDbCommand myCommand;
DataSet myDataSet;
OleDbDataAdapter myAdapter;
private void Form1_Load(object sender, System.EventArgs e)
{
try
{
//-------------------------------------------------------------------------------
//아래는 오라클용 접속 문자열, wink는 net service 이름
//-------------------------------------------------------------------------------
string ConStr = ("Provider=MSDAORA;data source=wink;User ID=scott;Password=tiger");
Conn = new OleDbConnection(ConStr);
Conn.Open();
String sql = "select * from emp ";
myCommand = new OleDbCommand(sql, Conn);
myAdapter = new OleDbDataAdapter();
myCommand.CommandType = CommandType.Text ;
myAdapter.SelectCommand = myCommand;
myDataSet = new DataSet();
myAdapter.Fill(myDataSet, "emp");
dataGrid1.DataSource = myDataSet;
dataGrid1.DataMember = "emp";
}
catch(Exception ex)
{
MessageBox.Show(ex.Message, "emp Table Loading");
}
finally
{
Conn.Close();
}
}
}
class Displayform
{
static void Main()
{
System.Windows.Forms.Application.Run(new GridForm());
}
}
![]() | ![]() ![]() | 12-27 | 2033 | |
![]() | ![]() ![]() | 12-11 | 1482 | |
53 | ![]() ![]() | 03-15 | 1244 | |
52 | ![]() ![]() | 01-31 | 1399 | |
51 | ![]() ![]() | 01-31 | 1260 | |
50 | ![]() ![]() | 01-31 | 1086 | |
49 | ![]() ![]() | 01-19 | 1402 | |
48 | ![]() ![]() | 01-11 | 1231 | |
47 | ![]() ![]() | 01-03 | 1731 | |
46 | ![]() ![]() | 12-27 | 2033 | |
45 | ![]() ![]() | 12-19 | 1496 | |
44 | ![]() ![]() | 12-14 | 1477 | |
43 | ![]() ![]() | 12-11 | 1482 | |
42 | ![]() ![]() | 12-09 | 1185 | |
41 | ![]() ![]() | 12-01 | 1402 | |
40 | ![]() ![]() | 12-01 | 1547 | |
39 | ![]() ![]() | 12-01 | 1055 |
댓글 없음:
댓글 쓰기