CodehighlightingproducedbyActiproCodeHighlighter(freeware)
http://www.CodeHighlighter.com/<" />

黄色网页视频 I 影音先锋日日狠狠久久 I 秋霞午夜毛片 I 秋霞一二三区 I 国产成人片无码视频 I 国产 精品 自在自线 I av免费观看网站 I 日本精品久久久久中文字幕5 I 91看视频 I 看全色黄大色黄女片18 I 精品不卡一区 I 亚洲最新精品 I 欧美 激情 在线 I 人妻少妇精品久久 I 国产99视频精品免费专区 I 欧美影院 I 欧美精品在欧美一区二区少妇 I av大片网站 I 国产精品黄色片 I 888久久 I 狠狠干最新 I 看看黄色一级片 I 黄色精品久久 I 三级av在线 I 69色综合 I 国产日韩欧美91 I 亚洲精品偷拍 I 激情小说亚洲图片 I 久久国产视频精品 I 国产综合精品一区二区三区 I 色婷婷国产 I 最新成人av在线 I 国产私拍精品 I 日韩成人影音 I 日日夜夜天天综合

Gentle.net Framework 入門二(基礎示例)

系統(tǒng) 2064 0
1. 一個基本的示例

通過該示例可以撐握以下內(nèi)容:

1) Gentle.net 是怎么把對象(類)和關系數(shù)據(jù)庫 (SQL) 關聯(lián)起來的 .

2) 使用 Gentle.net 插入,更新,返回實例信息,和刪除數(shù)據(jù) .

本示例中以人為實例,包括人 ID 和姓名 . 附上建表腳本

示例表代碼
<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--> if exists(select * fromdbo.sysobjectswhereid = object_id(N ' [dbo].[Peoples] ' )andOBJECTPROPERTY(id,N ' IsUserTable ' ) = 1 )
droptable[dbo].[Peoples]
GO

CREATETABLE[dbo].[Peoples](
[PeopleID][
int ]IDENTITY( 1 , 1 )NOTNULL,
[PeopleName][
char ]( 10 )COLLATEChinese_PRC_CI_ASNOTNULL
)ON[PRIMARY]
GO

接著附上代碼,相關使用請看代碼。

<!-- google_ad_client = "pub-6628499292856412"; google_ad_width = 468; google_ad_height = 60; google_ad_format = "468x60_as"; google_ad_type = "text_image"; google_ad_channel = ""; google_color_border = "000000"; google_color_bg = "FFFFFF"; google_color_link = "191919"; google_color_text = "000000"; google_color_url = "008000"; //-->
示例代碼
<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--> using System;
using Gentle.Framework;

namespace ConGentleStudy
{
/**/ /// <summary>
/// BaseExample的摘要說明。
/// </summary>

public class BaseExample
{
[STAThread]
static void Main( string []args)
{
Console.WriteLine(
" 創(chuàng)建人實例。 " );
Peoplespeople
= new Peoples( " xuanfeng " );
Console.WriteLine(
" 創(chuàng)建人實例。 " );
Broker.Insert(people);
Console.WriteLine(
" 創(chuàng)建人實例。 " );
people.PeopleName
= " peizunyou " ;
Console.WriteLine(
" 更新人的信息。 " );
Broker.Update(people);
Console.WriteLine(
" 創(chuàng)建返回實例信息的Key! " );
Keykey
= new Key( " Peoples " , typeof (Peoples), true , " PeopleName " , " peizunyou " );
Console.WriteLine(key.Count.ToString());

Console.WriteLine(
" 創(chuàng)建人實例! " );
Peoplespeople1
= new Peoples(); // 必須先實例化申請到空間,下步才不會出錯。
people1.PeopleName = " xiamfe " ;
Console.WriteLine(
" 返回一個人實例的信息! " );
// Peoplespeople1=(Peoples)Broker.RetrieveInstance(typeof(Peoples),key),這樣是將出錯
people1 = (Peoples)Broker.RetrieveInstance( typeof (Peoples),key); // 返回一個實例信息。
Console.WriteLine( " 輸出人的姓名 " );
Console.WriteLine(people1.PeopleName);
Console.WriteLine(
" 刪除信息! " );
Keykey_rem
= new Key( typeof (Peoples), true , " PeopleID " ,people1.PeopleID);
Broker.Remove(
typeof (Peoples),key_rem); // 主意,Key中提供的字段PeopleID是表中的主鍵,刪除才有效!

Console.WriteLine(
" 演示完成,按任何鍵退出! " );
Console.Read();

}


}



[TableName(
" Peoples " )]
public class Peoples
{
string name;
int id;
public Peoples( int _id, string _name)
{
this .name = _name;
this .id = _id;
}

public Peoples( string _name)
{
this .name = _name;
}

public Peoples()
{

}

[TableColumn(
" PeopleID " , true ),PrimaryKey(AutoGenerated = true )]
public int PeopleID
{
get { return this .id;}
set { this .id = value;}
}

[TableColumn(
" PeopleName " , true )]
public string PeopleName
{
get { return this .name;}
set { this .name = value;}
}


}

}

Gentle.net Framework 入門二(基礎示例)


更多文章、技術交流、商務合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯(lián)系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發(fā)表我的評論
最新評論 總共0條評論