17,086
社区成员
发帖
与我相关
我的任务
分享
string oracleConStr = "data source=orcl;user id=sys;password=o123";
public Form1()
{
InitializeComponent();
}
public void Connect_oracle()
{
try
{
OracleConnection oracleCon = new OracleConnection(oracleConStr);
oracleCon.Open();
OracleDataAdapter da = new OracleDataAdapter("select * from student_info", oracleCon);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView1.DataSource = ds.Tables[0].DefaultView;
}
catch(Exception a)
{
throw(a);
}
}
private void button1_Click(object sender, EventArgs e)
{
Connect_oracle();
}