基础问题,DataSet dataset()问题 一般有返回值的函数是 int dataset(), 一般是用int string 做为开头,有用DataSet做为开头吗? 我没有学好,DataSet是一个类呀? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public DataSet GetData(){} DataSet 你可以看成一种复杂的数据结构,所以当然能作为一个函数的返回值。可以直接赋给一个数据绑定控件的数据源。例如: /// <summary> /// Returns a DataSet which contains all database stored images /// </summary> /// <returns>A DataSet which contains all database stored images /// images</returns> public static DataSet GetImages() { StringBuilder sb = new StringBuilder(); sb.Append("SELECT ID, PIC"); sb.Append(" FROM TESTPIC"); //use the web.config to store the connection string, using statement ensure connection always closes using (OracleConnection connection = new OracleConnection(ConfigurationManager.ConnectionStrings["EasyThumbs_DB"].ConnectionString)) { try { OracleCommand command = new OracleCommand(sb.ToString(), connection); command.CommandType = CommandType.Text;; //execute stored procedure and return DataSet OracleDataAdapter da = new OracleDataAdapter(); da.SelectCommand = command; DataSet ds = new DataSet(); da.Fill(ds, "PIC"); return ds; } catch (OracleException ex) { throw new Exception(ex.Message, ex); } } } Winfrom中backgroundworker多线程的问题 留给C# 【高手】的问题 10分 很简单的一个白菜问题 怎样实现类似于FileDialog那样的对话框 WinForm中datagridview问题 如何在关闭窗口时弹出一个对话框 定义简单的interface为什么出错,有简单代码;谢谢! frame框架 怎样从把从数据库里面读出的图片显示在webform里面? C# 将字符串反过来读的函数是什么? 关于鼠标事件的问题 构造函数到底是什么意思啊 和java里面的构造方法一样吗 我糊涂了
{}
可以直接赋给一个数据绑定控件的数据源。例如: /// <summary>
/// Returns a DataSet which contains all database stored images
/// </summary>
/// <returns>A DataSet which contains all database stored images
/// images</returns>
public static DataSet GetImages()
{
StringBuilder sb = new StringBuilder();
sb.Append("SELECT ID, PIC");
sb.Append(" FROM TESTPIC"); //use the web.config to store the connection string, using statement ensure connection always closes
using (OracleConnection connection = new OracleConnection(ConfigurationManager.ConnectionStrings["EasyThumbs_DB"].ConnectionString))
{
try
{
OracleCommand command = new OracleCommand(sb.ToString(), connection);
command.CommandType = CommandType.Text;;
//execute stored procedure and return DataSet OracleDataAdapter da = new OracleDataAdapter();
da.SelectCommand = command;
DataSet ds = new DataSet();
da.Fill(ds, "PIC");
return ds;
}
catch (OracleException ex)
{
throw new Exception(ex.Message, ex);
}
}
}