后台代码:
using System.Data;
using Com.Think.Utility;public partial class Query_RoadIntersectSelect_test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
BindLoadName();
}
public void BindLoadName()
{
try
{
string sql1 = "select distinct 道路名称 from ROADNODE";
//string sql2 = "select distinct 道路名称_1 from roadnode";
DataSet ds1 = new DataSet();
ds1 = OracleHelper.ExDataSet(sql1);在OracleHelper类中的方法如下:
public static DataSet ExDataSet(string sql)
{
DataSet ds = new DataSet();
try
{
OracleDataAdapter Adapter = new OracleDataAdapter(sql, Conn);
Conn.Open();
Adapter.Fill(ds);
}
catch (Exception ex)
{
throw ex;
}
finally { Conn.Close(); }
return ds ;
}
VS没有报错,但是在运行时老是提示“在OracleHelper中并没有定义ExDataSet。
C#方法调用dataset
using System.Data;
using Com.Think.Utility;public partial class Query_RoadIntersectSelect_test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
BindLoadName();
}
public void BindLoadName()
{
try
{
string sql1 = "select distinct 道路名称 from ROADNODE";
//string sql2 = "select distinct 道路名称_1 from roadnode";
DataSet ds1 = new DataSet();
ds1 = OracleHelper.ExDataSet(sql1);在OracleHelper类中的方法如下:
public static DataSet ExDataSet(string sql)
{
DataSet ds = new DataSet();
try
{
OracleDataAdapter Adapter = new OracleDataAdapter(sql, Conn);
Conn.Open();
Adapter.Fill(ds);
}
catch (Exception ex)
{
throw ex;
}
finally { Conn.Close(); }
return ds ;
}
VS没有报错,但是在运行时老是提示“在OracleHelper中并没有定义ExDataSet。
C#方法调用dataset
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货