C#:DataSet和DataTable用法

来源:互联网 发布:微商客源软件 编辑:程序博客网 时间:2024/06/05 08:09

PS:此文仅做记录,不做他用

  • DataSet

 

         CDictionary cDictionary = new CDictionary();            DataSet dsept = new DataSet();            dsManageDept = cDictionary.GetDictionary("TABLE1", "1=1 AND ABC <> '1' ORDER BY 1");            DataView dvDept = dsManageDept.Tables[0].DefaultView;            this.ddlDept.DataSource = dvDept;            this.ddlDept.DataTextField = "M_NAME";            this.ddlDept.DataValueField = "M_ID";            this.ddlDept.DataBind();


 

 

  • DataTable
                string strSql = BingSQL();                     DataTable dt = cHanderOperater.GetDataTableBySql(strSql);                int iRowCount;//总记录数                if (dtd != null)                {                    //取得所有行数                    iRowCount = dtd.Rows.Count;                }                else                {                    iRowCount = 0;                }
0 0
原创粉丝点击