vs2008中怎样用代码连接oracle在gridview中显示呢?

2024-12-16 15:58:43
推荐回答(2个)
回答1:

OracleConnection cn = new OracleConnection("Data Source=ORACLE实例名;User Id=用户名;Password=密码");
cn.Open();
using (OracleCommand cmd = new OracleCommand("SELECT * from 表名"), cn))
{
this.GridView1.DataSource = cmd.ExecuteReader(CommandBehavior.CloseConnection);
this.GridView1.DataBind();
}

回答2: