CYQ.Data components

CYQ.Data support multi-database application [Txt,Xml,Access, MSSQL, Oracle,SQLite,MySql], help easily and quickly to develop your project

CYQ.Data Components Getting Started Guide [Part 1]

Guide | | | pubdate :2011/7/2 16:03:31#TopicOwner  

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

<add name="Conn" connectionString="server=.;database=cyqdata.com;uid=sa;pwd=123456" providerName="System.Data.SqlClient"/>

2:Access 2003 Database link example, V4.3 before, winform / web unified with [AccessDbNameForWeb]


<add key="AccessDbNameForWeb" value="App_Data/myspace.mdb" /></appSettings>

<add name="Conn" connectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0}" providerName="System.Data.OleDb"/>

3:Oracle Database Link Example

<add name="Conn" connectionString="Provider=MSDAORA;Data Source=cyqdata.com;User ID=sa;Password=123456;" providerName="System.Data.OracleClient"/>

4:SQLite Database link example, V4.3 before, winform / web unified with [SQLiteDbNameForWeb]


<add key="SQLiteDbNameForWeb" value="App_Data/myspace.mdb" /></appSettings>

<add name="Conn" connectionString="Data Source={0}" providerName="System.Data.SQLite"/>

5:MySQL Database Link Example

<add name="Conn" connectionString="Server=;Port=1234;Database=mysql;uid=sa;pwd=12346" providerName="MySql.Data.MySqlClient"/>

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();

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");
using(MAction action=new MAction("TableName"))

Try 2: Data fill

MAction action = new MAction("TableName");
if (action.Fill(888))//Get id=888 's value

     //For UI:SetTo与GetFrom
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("UserName");

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,

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

Then try 2: Data fill

MAction action = new MAction(TableNames.Users);
if (action.Fill("id=888"))
            int userName=action.Get<int>(Users.UserName);//Use Enum

Chinese version of the link:http://www.cyqdata.com/cyqdata/article-detail-411

More tutorials:

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.

Post Comment



    数据框架 CYQ.Data QQ群:6033006
    使用本框架进行开发,入门简单,开发效率高,性能优越,更有详尽的API文档,有相关的使用帮助文章、示例文章、更甚有相关的视频教程及辅助工具。 关键还是免费与开源,实在是居家旅行、项目开发、学习研究的必备良品!!!!!!


Article Search