CYQ.Data 数据层框架CYQ.Data 是一款由路过秋天创作的支持多数据库应用[Txt,Xml,Access,MSSQL,Oracle,SQLite,MySql]的底层数据库操作类库,使用本类库可以轻松快速开发项目(QQ群:6033006)。 |
CYQ.Data Components Getting Started Guide [Part 1]
快速使用帮助 |
|
|
| #楼主 |
Download Address : CYQ.Data Tiny Data Components Download Center Learn how to use :
I:Add CYQ.Data reference to project II:Configuration database link web.config or app.config Tip: winform need right under the app.config attributes, for Yi options will change the content. 1:MSSQL Database Link Example <connectionStrings> <add name="Conn" connectionString="server=.;database=cyqdata.com;uid=sa;pwd=123456" providerName="System.Data.SqlClient"/> < SPAN>connectionStrings> 2:Access 2003 Database link example, V4.3 before, winform / web unified with [AccessDbNameForWeb] <appSettings> <add key="AccessDbNameForWeb" value="App_Data/myspace.mdb" /></appSettings> <connectionStrings> <add name="Conn" connectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0}" providerName="System.Data.OleDb"/> < SPAN>connectionStrings> 3:Oracle Database Link Example <connectionStrings> <add name="Conn" connectionString="Provider=MSDAORA;Data Source=cyqdata.com;User ID=sa;Password=123456;" providerName="System.Data.OracleClient"/> < SPAN>connectionStrings> 4:SQLite Database link example, V4.3 before, winform / web unified with [SQLiteDbNameForWeb] <appSettings> <add key="SQLiteDbNameForWeb" value="App_Data/myspace.mdb" /></appSettings> <connectionStrings> <add name="Conn" connectionString="Data Source={0}" providerName="System.Data.SQLite"/> < SPAN>connectionStrings> 5:MySQL Database Link Example <connectionStrings> <add name="Conn" connectionString="Server=127.0.0.1;Port=1234;Database=mysql;uid=sa;pwd=12346" providerName="MySql.Data.MySqlClient"/> < SPAN>connectionStrings> III:Generate a page stored procedure to the database[This step only applies to MSSQL, Oracle, other database, omit this step, have built-in paging] 1:Way 1, the code created to generate stored procedures, applies only to prior version V4.3 [not included V4.3] Please out CYQ.Data.SQL.OutPutData, generation, just find the background code execution aspx page: OutPutData data = new OutPutData(); data.ExeCreateProc(FiledDescriptionType.Sql2005); 2:The second way, using enumeration tool to generate 1:Download the enumeration tool 2:Run: configure link link, click the button to automatically generate stored procedures to complete. 3:Check: go to the appropriate database to see if the stored procedure to generate SelectBase page. IV:Try coding 1:The original way to write code Try 1: Data Binding original :
MAction action = new MAction("TableName");
GridView1.DataSource = action.Select(); GridView1.DataBind(); action.Close(); Shorthand:
using(MAction action=new MAction("TableName"))
{
action.Select().Bind(GridView1);
}
Try 2: Data fill MAction action = new MAction("TableName");
if (action.Fill(888))//Get id=888 's value { //For UI:SetTo与GetFrom
action.SetTo(labUserName);//labUserName is Lable Control。 //Control ID may agree to a "three-letter prefix" + field name, such as labUserName, UserName for the table field names.
//For No UI:Set 与 Get int userName=action.Get
action.Close(); } 2:Add Enum To Write Code Doubt: the above example a "TableName", "UserName", so knock dead code, or if you modify the table name field is not difficult to find problems? Answer: One way: to please the CYQ.Data.SQL.OutPutData, generated enumeration, just find a code-behind aspx page OutPutData data = new OutPutData();
Response.Write(data.OutPutAllTableEnum(TableType.U, FiledDescriptionType.Sql2005,false)); Operation: a new class called the name of TableNames.cs, to automatically delete all the information generated, leaving a blank, while the output of the enumeration copy and paste the above into it. Second way: V4.3 version has been removed OutPutData class, auxiliary tools to easily generate enumerate the files. Then try 1: Data Binding using(MAction action = new MAction(TableNames.Users))//Use Enum
{ action.Select().Bind(GridView1); } Then try 2: Data fill MAction action = new MAction(TableNames.Users);
if (action.Fill("id=888")) {
action.SetTo(labUserName); int userName=action.Get<int>
action.Close(); } Chinese version of the link:http://cyqdata.com/cyqdata/article-detail-411 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/29 1:40:59 | #2 | |
Du2Zdd It was hard It was hard to get a grip on everything, since it was impossible to take in the entire surroundings of scenes. |
suba suba[89.28.10.*]2018/12/21 17:33:17 | #1 | |
BWyT5C Very good article post.Much thanks again. Fantastic. |
发表评论
论坛公告
帖子搜索
最新帖子
最新评论
- 请教博主。我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年就过了!!!!