62,046
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Oracle.DataAccess.Client;
namespace OracleDB
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
// Connect
string constr = "DATA SOURCE=;PERSIST SECURITY INFO=True;USER ID=SCOTT;PASSWORD=scott";
OracleConnection con = new OracleConnection(constr);
string SqlStr = "select * from emp";
OracleDataAdapter ada = new OracleDataAdapter(SqlStr, constr);
DataSet ds = new DataSet();
ada.Fill(ds);
this.dataGridView1.DataSource = ds.Tables[0];//0表示数据集第一个表
}
}
}