IsEmpty() private méthode

private IsEmpty ( ) : bool
Résultat bool
Exemple #1
0
        /// <summary>
        /// Formats the data set to string.
        /// </summary>
        /// <param name="param">The param.</param>
        /// <returns></returns>
        /// 作    者:zcnie
        /// 创建时间:2011-1-15
        public static string FormatDataSetToString(DataSet ds)
        {
            if (ds.IsEmpty())
                return string.Empty;

            StringBuilder sb = new StringBuilder();

            foreach (DataTable dt in ds.Tables)
            {
                sb.Append(dt.TableName);
                sb.Append("\u0001\u0001\u0004");

                foreach (DataColumn dc in dt.Columns)
                {
                    sb.Append(dc.ColumnName);
                    sb.Append("\u0001");
                }
                sb.Remove(sb.Length - 1, 1); //删除最后一个\u0001
                sb.Append("\u0002");

                foreach (DataRow dr in dt.Rows)
                {
                    for (int i = 0; i < dt.Columns.Count; i++)
                    {
                        sb.Append(dr[i].ToString());
                        sb.Append("\u0001");
                    }
                    sb.Remove(sb.Length - 1, 1);       //删除最后一个\u0001
                    sb.Append("\u0002");
                }
                sb.Append("\u0003");
            }

            return sb.ToString();
        }