![]() | CYQ.Data 数据层框架CYQ.Data 是一款由路过秋天创作的支持多数据库应用[Txt,Xml,Access,MSSQL,Oracle,SQLite,MySql]的底层数据库操作类库,使用本类库可以轻松快速开发项目(QQ群:6033006)。 |
CYQ.Data Components Getting Started Guide [Part 2]-[MAction Data Query- Fill And Select]
快速使用帮助 |
|
|
| #楼主 |
In this section: [with * content for the new version of the performance function, the old version might not have this feature] Benpian continue on a content, this section describes the use of all relevant queries.
Main Summary:
1: Fill one-line data manipulation operations and GetCount, Exists (*) operation.
2: Select multiple lines of data manipulation operations
3: list-bound controls operate with the paging controls
4: multi-table query and bind the view and custom SQL
Single data operation I:Fill - a single query Method Prototype:public bool Fill(object where) Example 1: Direct ID using(MAction action = new MAction(TableNames.Users))
{
if (action.Fill(888))//Query ID = 888 one-way data { action.SetTo(lblUserName); } } Example 2: where conditions for transmission using(MAction action = new MAction(TableNames.Users))
{
if (action.Fill("id=888 or UserName='cyqdata"))//Query ID=888 or UserName is "cyqdata" one-way data {
action.SetTo(lblUserName); } } Example 3: where conditions are attached order by using(MAction action = new MAction(TableNames.Users))
{
if (action.Fill("id>888 order by id desc"))//Query ID>888' result,ID to take the results of the largest single data {
action.SetTo(lblUserName); } } Example 4: MDataRow line data transfer entity using(MAction action = new MAction(TableNames.Users))
{ }if (action.Fill("888")) { UserInfo info=action.Data.ToEntity<UserInfo>();//UserInfo transfer entity。 } II:GetCount -Take the total number of statistics Method Prototype:public int GetCount(string where)
Example : using(MAction action = new MAction(TableNames.Users))
{ int count=action.GetCount("id>10"); } III:Exists - The existence of the conditions specified data (*) Method Prototype:public int Exists(string where) Example : using(MAction action = new MAction(TableNames.Users))
{ bool userExists=action.Exists("UserName='cyqdata'"); }
Multi-line data manipulation Ⅳ:Select - Multiple Data Query Method Prototype:
1:public MDataTable Select() 2:public MDataTable Select(string where)(*) 3:public MDataTable Select(int PageIndex, int PageSize, string Where, out int RowCount) Example 1: using(MAction action = new MAction(TableNames.Users))
{ MDataTable tabme = action.Select();//Select All Data } Example 2: using(MAction action = new MAction(TableNames.Users))
{ MDataTable tabme = action.Select("id>10 order by id desc");//Select data by where } Example 3: int count;// return record count
using(MAction action = new MAction(TableNames.Users))
{
MDataTable tabme = action.Select(1,10,"id>10 order by id desc",out count); //Select Data by where and with pager
}
List of bind operation
Ⅴ:Bind To GridView/DataList/Repeater Example 1: Select All And Bind To List Control using(MAction action = new MAction(TableNames.Users))
{ action.Select().Bind(gvUsers); } Example 2:Bind with paging controls [Down Paging Control:http://www.cyqdata.cn/download/article-detail-28683] public void BindData()
{ int count; using(MAction action = new MAction(TableNames.Users))
{
action.Select(Pager1.PageIndex,Pager1.PageSize,"id>10 order by id desc",out count).Bind(gvUsers); } Pager1.Count = count;//Set Record Count
Pager1.BindName = "BindData";//Bind Method Name,Symbols need to modify Public }
Multi-table query and bind Ⅵ:View Way Example 1:And operation of the same table, the only difference is the name of the table name into view using(MAction action = new MAction(ViewNames.V_Users))
{ MDataTable tabme = action.Select();//Select All View Data }
Ⅶ:Multi-table query: Customize multi-table SQL statement construct Example 1: public void BindData()
{ string customTable = "(select u.*,m.Body from Users u left join Message m on u.ID=m.UserID) v";
int count; using(MAction action = new MAction(customTable))
{
action.Select(Pager1.PageIndex,Pager1.PageSize,"id>10 order by id desc",out count).Bind(gvUsers); } Pager1.Count = count;
Pager1.BindName = "BindData";
} Description: In the specific use, in order to facilitate the management, directly in a custom SQL statement is not written directly in the interface so, you can build a new item unified project management custom SQL. Chinese version of the link:http://www.cyqdata.cn/cyqdata/article-detail-412 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] ![]() |
Anderson[176.31.68.*]2012/6/6 11:01:34 | #1 | |
![]() | altazar / Проверил сейчас. Прежний HUD возвращается, если удалить файлы мода.Steam/steamapps/common/skyrim/Data/Interface. Оттуда удали папку exported и файл faemtirvsoenu |
发表评论
论坛公告
帖子搜索
最新帖子
最新评论
- 请教博主。我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年就过了!!!!