CYQ.Data componentsCYQ.Data support multi-database application [Txt,Xml,Access, MSSQL, Oracle,SQLite,MySql], help easily and quickly to develop your project |
MDataTable 原理解析 数据行
Principles |
|
|
| #TopicOwner |
有了数据结构单元DataCell之后,数据单元行也就很容易写了,因为,所有的数据单元加起来,就成了数据行了
于是,我们很轻易的写出了以下类: Code
/**//// <summary> /// 一行数据 /// </summary> public class MDataRow : List<MDataCell> { public MDataRow() : base() { } public MDataRow(int capacity) : base(capacity) { } }
看,没几行代码 现在,我们为行加几个常用的属性,比如访问行所属的表名,还有从行访问出其列的结构,顺便加上一个数据库链接字符串
如下: Code
常用访问属性#region 常用访问属性 private string _TableName; /**//// <summary> /// 数据库表名 /// </summary> public string TableName { get { return _TableName; } set { _TableName = value; } } private string _ConnectionString; /**//// <summary> /// 所属的表的数据库链接字符串 /// </summary> public string ConnectionString { get { return _ConnectionString; } set { _ConnectionString = value; } } private MDataColumn _Columns = null; /**//// <summary> /// 数据列集合 /// </summary> public MDataColumn Columns { get { if (_Columns == null) { _Columns = new MDataColumn(base.Count); for (int i = 0; i < base.Count; i++) { _Columns.Add(base[i].DataStruct); } } return _Columns; } } #endregion
OK,此至属性也加完了,顺便加个克隆方法 Code
克隆#region 克隆 public MDataRow Clone() { MDataRow dataRow = new MDataRow(base.Count); for (int i = 0; i < base.Count; i++) { MDataCellStruct mcb = base[i].DataStruct; MDataCell mdc = new MDataCell(ref mcb); mdc.Value = base[i].Value; dataRow.Add(mdc); } dataRow.ConnectionString = this.ConnectionString; dataRow.TableName = this.TableName; return dataRow; } #endregion 至此,数据行也构建完成了
|
Post Comment
Bulletin
Article Search
Categories
- Platform for dynamic (20)
- Feedback (9)
- Guide (33)
- Principles (19)
- Project-Case (8)
- Business & Buy (2)
- Technology exchange (45)
New Article
- CYQ.Data Components Getting Started Guide [Part 5]-[MProc Execute Stored Procedures or SQL]
- CYQ.Data Components Getting Started Guide [Part 4]-[MAction Insert Delete Update]
- CYQ.Data Components Getting Started Guide [Part 3]-[MAction Get And Set Value]
- CYQ.Data Components Getting Started Guide [Part 2]-[MAction Data Query- Fill And Select]
- CYQ.Data Components Getting Started Guide [Part 1]
New Comment
- When some one searches for his necessary thing, therefore he/she wishes to be available that in detail, so that thing is maintained over here.
- This is my first time pay a quick visit at here and i am in fact happy to read everthing at alone place.
- I truly appreciate this blog article.Really thank you! Cool.
- please pay a visit to the web sites we follow, like this one particular, as it represents our picks in the web
- Really enjoyed this post.Really thank you!
- Really enjoyed this article.Really looking forward to read more. Great.
- poker bonuses What are the norms of copyright of web content? How as it different from Patent?
- Wow! Thank you! I permanently needed to write on my blog something like that. Can I implement a fragment of your post to my site?
- This website was how do I say it? Relevant!! Finally I ave found something that helped me. Cheers!
- I was reading through some of your content on this internet site and I believe this web site is very informative ! Continue posting.