![]() | CYQ.Data 数据层框架CYQ.Data 是一款由路过秋天创作的支持多数据库应用[Txt,Xml,Access,MSSQL,Oracle,SQLite,MySql]的底层数据库操作类库,使用本类库可以轻松快速开发项目(QQ群:6033006)。 |
CYQ.Data Components Getting Started Guide [Part 3]-[MAction Get And Set Value]
快速使用帮助 |
|
|
| #楼主 |
In this section: continue on a content, this section describes all the values associated with the assignment operator.
1: UI operation: GetFrom and SetTo 2: non-UI operations: Get and Set
3: DrowDownList operation of the UI controls such as list
Common part of the code described earlier, we assume that the query through the following methods to complete row of data using(MAction action = new MAction(TableNames.Users))
{
if (action.Fill(888)) { //This is to say in this section and the assignment of values } } I: UI Operation Description: Controls ID to comply with naming convention: any three-letter prefix + field name For example, a TextBox control with ID: txtUserName Compared txt (any prefix) + UserName (the database field name) 1:GetFrom - Get value from control and set value to MDataRow Method Prototype:
public void GetFrom(Control ct) public void GetFrom(Control ct, object value) Example 1: action.GetFrom(txtUserName);//Get value from control and set value to MDataRow
//Equivalent to
action.Data["UserName"].Value=txtUserName.Text; Example 2: action.GetFrom(txtUserName, "cyqdata");//Value assigned to the custom data line, ignoring the value of the control.
//Equivalent to
action.Data["UserName"].Value="cyqdata"; 2:SetTo 将数据行中的数据设置到控件 Method Prototype:
public void SetTo(Control ct)
public void SetTo(Control ct, object value) public void SetTo(Control ct, object value, bool isControlEnabled) Example 1: action.SetTo(txtUserName);//Get value from MDataRow and set value to txtUserName control。
//Equivalent to txtUserName.Text=action.Data["UserName"].Value.ToString(); Example 2: action.SetTo(txtUserName,"cyqdata");//Assigned to the control, data from the custom values
//Equivalent to txtUserName.Text="cyqdata"; Example 3: action.SetTo(txtUserName,null,false);//Assigned to the control, and set the Enable property of the control
//Equivalent to txtUserName.Text=action.Data["UserName"].Value.ToString();
txtUserName.Enabled=false; 二:Non-UI Operation 1:Get - get value from MDataRow Method Prototype : public T Get<T>(object key) Example 1: string userName = action.Get<string>(Users.UserName);//get value from MDataRow
//Equivalent to string userName = action.Data["UserName"].Value.ToString(); 2:Set - set value to MDataRow Method Prototype : public void Set(object key,object value) Example 1: action.Set(Users.UserName, "cyqdata");//set value 'cyqdata' to MdataRow's column 'UserName'
//Equivalent to action.Data["UserName"].Value = "cyqdata"; III:UI Operation:dropdown list of controls and other UI operations Method Prototype :
public MAction Bind((object control) public MAction Bind(string control, string where)
public MAction Bind((object control, string where, object text, object value) Example 1: using(MAction action = new MAction(TableNames.Users))
{
action.Bind(ddlUserName);//Query the data and bind the drop-down list, text field for the UserName [remove three arbitrary prefix], range of ID } Example 2: using(MAction action = new MAction(TableNames.Users))
{
action.Bind(ddlUserName,"id>10");//Query data and bound by conditions of the drop-down list, text field for the UserName, range of ID } Example 3: using(MAction action = new MAction(TableNames.Users))
{
action.Bind(ddlUserName,"id>10",Users.NickName,Users.ID);//Query data and bound by conditions of the drop-down list, text field is NickName, range of ID } Chinese version of the link:http://www.cyqdata.com/cyqdata/article-detail-413 More tutorials: 1:CYQ.Data Components Getting Started Guide [Part 1] 2:CYQ.Data Components Getting Started Guide [Part 2]-[MAction Data Query- Fill And Select] 3:CYQ.Data Components Getting Started Guide [Part 3]-[MAction Get And Set Value] 4:CYQ.Data Components Getting Started Guide [Part 4]-[MAction Insert Delete Update] 5:CYQ.Data Components Getting Started Guide [Part 5]-[MProc Execute Stored Procedures or SQL]
![]() |
https://royalcbd.com[89.28.10.*]2020/9/28 23:52:44 | #4 | |
![]() | 8i3qOB I truly appreciate this post.Thanks Again. Will read on |
is cbd legal in wash[89.28.10.*]2020/9/25 20:24:08 | #3 | |
![]() | OXGmBZ Very good info. Lucky me I found your website by chance (stumbleupon). I ave saved as a favorite for later! |
Silvia[62.210.78.*]2014/8/25 3:40:56 | #2 | |
![]() | Hot damn, looikng pretty useful buddy. |
Idana[183.177.122.*]2011/10/7 21:17:11 | #1 | |
![]() | It's about time soomene wrote about this. |
发表评论
论坛公告
帖子搜索
最新帖子
最新评论
- 请教博主。我mysql的提示 V5.7.7.4 MySql.xxxx:check the tablename "tbl_site_info" is exist? error:ExeDataReader():Expression #1 of ORDER BY clause is not in SELECT list, references column 'information_schema.s1.ORDINAL_POSITION' which is not in SELECT list; this is incompatible with DISTINCT 配置如下: <?xml version="1.0" encoding="utf-8" ?> <configuration> <connectionStrings> <add name="Conn" connectionString="host=192.168.3.101;Port=3306;Database=xxxxx;uid=root;pwd=2017" providerName="MySql.Data.MySqlClient"/> </connectionStrings> </configuration>
- 查询语句有点问题,软件启动时查询语句可以从数据库查询出数据,软件一直运行时无论怎么修改数据库,查询出来的还是老数据,不知道是为什么
- 我语句中用到了union all而且两个查询都有查询条件,action.select总是不成功,不知道有没有什么好的解决办法,谢谢
- 大神,如果我想通过一个对象(从数据映射过来的)要插入的话,我需要遍历字段然后每个set一下吗?有没有更好的方法??
- 真心好用,想问下秋天直接拼写sql怕注入吗
- V4.5后,好多方法都改变了,求来个新的日志帮助
- 請問大神V5源碼要多少錢 我是和交流過的
- 楼主,,从数据库里查出来并绑定datagridview,但是显示的都是数据库里的英文名,怎么改??好纠结啊这个。。。。
- 我想问一下,主从表添加怎样处理
- 10年就过了!!!!