net 2.0 fundamentals - zawhlainghtun.files.wordpress.com...• memory ကုိ...
TRANSCRIPT
.Net 2.0 fundamentals ျမနမာ ဘာသာျဖင႔ ေရးသား ထားပါသည ။
Asp.net 2.0 က စတငေလ႔လာမည႔သမား အတြက အခကအခ မရေစရန လတရငး ထမစြာ ဘာသာျပန မေ၀ေပးထားပါသည ။
2010
ျပည႔ျဖးေမာငေမာင ( B.C ( Tech ) ( Hons ) ) MCTS , MCPD . Web site : http://myanmaraspnet.multiply.com
CHAPTER 1
1.1 .Net Framework
1.2 Structure of .Net Application
1.3 Asp.Net & C#.Net
1.4 Asp.Net Versions
1.5 Client Server Architecture
1.6 Type of Applications create with Asp.Net
1.7 Event Flows of Asp.net Application
1.8 Event Flows of Asp.net Page
1.9 Asp.Net File Types
CHAPTER 2
2.1 Master Page
2.2 Content Page
2.3 Web Server Controls
2.4 Asp.Net Special Folders
2.5 Data Bound Controls
2.6 Tracing Key
CHAPTER 3
3.1 Data Types
3.2 Variable Declaration and Assign
3.3 Constructor
3.4 Method and Parameters
3.5 Operator
3.6 Function and Variable Scope
3.7 C# Data Type Convertions
3.8 Statements
3.9 Loops
CHAPTER 4
4.1 Validators
4.2 Web User Control, Custom Control, Composite Control
CHAPTER 5
5.1 State Management Technologies
CHAPTER 6
6.1 ADO.Net
CHAPTER 1
1.1 .Net Framework
.Net framework အပငးတြင မသမျဖစ သရနလအပေသာ CLR ( Common Language Runtime ) နင႔ BCL ( Base
Class Library ) တ႔ကသာ ရငးျပပါမည ။
CLR ( Common Language Runtime ) CLR ( Common Language Runtime ) CLR ( Common Language Runtime ) CLR ( Common Language Runtime )
• Memory က စမခန႔ခြျခငး , thread မား ၊ code မား မနကနစြာ လပေဆာငမ ရမရ ၊ compilation နင႔ တျခားေသာ System လပေဆာငခကမားက လပေဆာငသည ။
• Programming Coding မားက Compile လပရာမ ရရလာေသာ Assembly( IL+Metadata ) တ႔က စကနားလညေစေသာ Code ( Native Code ) သ႔ ေျပာငးျခငး ကလညး CLR အတြငးပငးရ Just-In-Time Compiler ၏ အကအညမ တဆင႔ ေျပာငးလ လပေဆာငေပးသည ။
• Memory ေပၚတြင မလအပေသာ ေနရာမား ( Garbage Collection ) က အလေလာက ရငးလငးေပးသည ။ • CLR သည IIS ( Internet Information Service ) ေပၚတြင host လပနငသည ။ • CLR ၏ လပေဆာငခကမားထမ အေရးပါေသာ အခက အခ ႔ကသာ ေဖၚျပေပးထားပါသည ။
BCL ( Base Class Library )
BCL သည namespaces မားက စစညးထားျခငး ျဖစသည ။ Namespace ဆသညမာ သကဆငရာ အပစ
အမးအစားအလက သကဆငရာ function မားက စစညးထားသည႔ သေဘာပင ျဖစသည ။
ဥပမာအားျဖင႔ System , System.Data , System.Data.SqlClient စသညတ႔သည Namespace မားပငျဖစသည ။
ကြနေတာတ႔ အေနျဖင႔ using က အသးျပျပး သကဆငရာ Namespace က ေၾကျငာရျဖင႔ ထ namespace ၏
သကဆငရာ function ၊ events နင႔ properties မားက အလြယတက ရယ အသးျပနငသည ။
1.2 Structure of .Net Application
Coding တစခက Compile လပလကပါက MSIL ထြကလာသည ။ MSIL ထတြင .exe or .dll ဖငတ႔ ပါ၀ငလာသည ။
Assembly ( IL + Metadata ) သေဘာတရားပင ျဖစသည ။ ထအပငးအထ စကနားလညေသာ Code မျဖစေသးပါ ။
CLR ၏ အကအညျဖင႔သာ MSIL က အဆင႔ဆင႔ စကနားလညေသာ Code ( Native Code ) အျဖစ ေျပာငးလျပးမ သာ
စကေပၚတြင အလပလပနငျခငး ျဖစသည ။ CLR သာ မရခ႔ပါလင စကေပၚတြင အလပလပနငေတာ႔မည မဟတပ
Compile time တြငသာ ရပတန႔သြားမည ျဖစသည ။ ဒေနရာတြင မတသားရန တစခ ေျပာျပလပါသည ။ Programmer
မားေျပာေျပာေနေသာ Error ဆသညမာ Compile Time တြင တကျခငးျဖစျပး Exception ဆသညမာ CLR
တကယအလပလပေနေသာ Run time တြင တကလာျခငး ျဖစသည ။
1.3 Asp.Net & C#.Net
Programmer ေတာေတာမားမား ျငငးခနေလ႔ ရပါသည ။
- Asp.Net သည Programming Language မဟတပါ ။
- Asp.Net သည Framework တစခသာ ျဖစသည ။ Microsoft ၏ Web Application မားက develop လပရန
အတြက ဖနတးထားျခငး ျဖစသည ။
- ASP သည Active Server Pages က ဆလသည ။
- ASP.NET သည server-side scripting မား ေရးသားရန နညးပညာ သစ တစခသာျဖစသည ။
- C# ၏ အသထြကမာ "C sharp" တစျဖစသည ။
- C# သည Programmer မားအတြက Application မားက Microsoft ၏ .Net Framework ေပၚတြင
လငျမနစြာ အေကာငအထည ေဖၚရန တထြငထားေသာ Programming Language အသစတစခ သာ
ျဖစသည ။
- CCCC#.Net#.Net#.Net#.Net ဆသညမာ .Net framework ေပၚတြင Programming Language ျဖစသည႔ C# ျဖင႔
ေရးသားထားျခငး ျဖစသည ဟ ဆလသည ။
1.4 Asp.Net Versions မားအေၾကာငး
2009 ခနစ အထ ထြကခ႔ေသာ Asp.Net Versions မားက ေဖၚျပေပးထားပါတယ ။
2002 2003 2005 2006 2009
Visual Studio VS.Net 2002 VS.Net 2003 VS.Net 2005 VS.Net 2005 VS.Net 2008
Languages C# v1.0
VB.Net ( v7.0)
C# v1.1
VB.Net ( v7.1)
C# v2.0
VB2005 ( v8.0)
As before C# v3.0
VB9
Framework Netfx v1.0 Netfx v1.1 Netfx v2.0 Netfx v3.0 Netfx v3.5
Engine ( CLR ) CLR v1.0 CLR v1.1 CLR v2.0 Same version Same version
1.5 Client Server Architecture
Client ေခၚ Browser သည server ထမ web page မားက requests ( ေတာငးခရန ) လပရန တာ၀နယသည ။
Server သည Browser မ ေတာငးခလာေသာ web page မားက responseresponseresponseresponse ( ေပးပ႔ရန ) လပရန တာ၀နယရသည ။
Browsers အမးအစား အခ ႔မာ Mozila Firefox , IE ( Internet Explorer ) , Flock စသညတ႔ ျဖစသည ။
Server အမးအစား မာ Microsoft မ ထတလပထားေသာ IIS ( Internet Information Service ) ျဖစသည ။
ထသ႔ Client နင႔ Server တ႔ တစခ နင႔ တစခအၾကားတြင web page မားက ေတာငးချခငး ၊ ေပးပ႔ျခငး ျပလပရာတြင
http ( hyper text transfer protocol ) ( Link ပါေသာ စာသားမားက သယေဆာငေပးနငေသာ protocol ) က
အသးျပသည ။
1.6 Type of Applications create with Asp.Net
Asp.Net ျဖင႔ Develop လပနငေသာ Applications ၅ မး ရပါတယ ။ အဒါေတြကေတာ႔
Window Application
Web Application
Web Service
Console Application
Mobile Application စသည တ႔ျဖစသည ။
Asp.Net Application မာ ရတ႔ Events ေတြန႔ Asp.NetAsp.NetAsp.NetAsp.Net PagePagePagePage တစခရ႔ ဥးစားေပး Events ေတြက အခလပ
တြမတထားပါ ။
1.7 Event Flows of Asp.net Application
Asp.Net Application မာ ရတ႔ Events ေတြက အေပၚကေနေအာက ဒလ ဥးစားေပးသြားပါတယ ။
• Application Level Events : (Global.asax)
• Page_Init : page and controls are initialized
• Page_Load : all the controls and page are loaded
• Change events : for controls are processed
• Click events : for controls are processed
• Page_PreRender : page is about to render
• Page_Unload : page is unloaded from memory ( Page Dead )
1.8 Event Flows of Asp.net Page
Asp.Net Page တစခ မာ ရတ႔ Events ေတြကေတာ႔ အေပၚကေနေအာက ဒလ ဥးစားေပးသြားပါတယ ။
• Pre_init ( Initialize မလပခင အခန )
• Init ( Page က Initialize လပေနစဥ အခန )
• InitComplete ( Page က Initialize လပျပးခန )
• Pre_Load ( Page က Load မလပခင အခန )
• Load (Page က Load လပေနေသာ အခန )
• LoadComplete ( Page က Load လပျပးေသာ အခန )
• PreRender ( Page က processing မလပခငအခန )
• RenderComplete ( Page က processing လပျပးေသာ အခန )
• Unload ( Page က Server ေပၚမ ျဖတခလကေသာ အခန )
1.9 Asp.Net File Types
Asp.Net မာ File Types မားစြာ ရတ႔ အထကမ မသမျဖစ သရမယ႔ File အမးအစားမားက သာ ေဖၚျပ
ေပးထား ပါတယ ။
• .aspx
.aspx သည Web page ၏ Design ပငးက ရညညြနးသည ။
• .cs
.cs သည code-behind module ဟ ေခၚဆေလ႔ရျပး Design ၏ ေနာကတြင ကပပါလာေသာ မမေရးမည႔ C# Language က ရညညြနးသည႔ File extension တစမးျဖစသည ။ ဥပမာ ။ ။ C# Language က ယအသးျပထားသျဖင႔ ( pagename.aspx.cs ) ျဖစေနေသာလညး VB Language က ယ အသးျပထားပါက ( pagename.aspx.vb ) ျဖစသြားမည ျဖစသည ။
• .ascx
User controls ေရးသားရာတြင ေတြ႔ျမငရမည႔ File extension တစခ ျဖစသည ။
• .asmx
Web services ေရးသားရာတြင ေတြ႔ျမငရမည႔ File extension အမးအစားတစခ ျဖစသည ။
• .resx
Resources မား ေရးသားရာတြင ေတြ႔ျမငရမည႔ File extension တစခ ျဖစသည ။ နငငတကာ နင႔ သကဆငေသာ Application မားက Develop လပရာတြင Resource File မားက ထည႔သြငးေရးသားရသည ။
Global resource နင႔ Local Resource ဆကာ Resource နစမး ရသည ။
• Global.asax
Application နင႔ Session တ႔ ၏ အစ နင႔ အဆး စသည တ႔က ထနးခပရန အသးျပသည ။
• Web.config
Application တစခလး၏ အျပငအဆင အားလးက Web.config တြင သတမတ ေရးသားနငသည ။ Database နင႔ ခတဆကျခငး မး ကလညး web.config တြင ထည႔သြငး ေရးသားနငသည ။
CHAPTER 2
2.1 Master Page
Master Page က Web Pages မား ၏ ေနာကတြင တညေသာ ေခါငးစဥ ၊ တညေသာ Design ၊ တညေသာ
Menu မား ၏ အသြငအျပင အျဖစ ေပၚေစလေသာ အခါမးတြင တြင အသးျပသည ။ Master Page တြင ပါ၀ငေသာ
တစခတညးေသာ Control မာ ContentPlaceHolder control ျဖစသည ။ Master Page တစခက Web Pages
မားစြာနင႔ ခတဆက အသးျပနငသည ။
2.2 Content Page
Content Page ဆသညမာ Master Page နင႔ ခတဆကထားေသာ Web Page မား ဘကမ အျမငျဖစသည ။
Content Page ဘကမ Master Page ၏ Design က ျပငရန မျဖစနငပါ ။
2.3 Web Server Controls
Web Server Controls က ေလ႔လာရာတြင လြယကေစရန ေအာကတြင အပစခြကာ ေဖၚျပေပးထားပါတယ ။
Web Server control တစခက အသးျပတငး မျဖစမေန ပါရမည႔ အခက ၂ ခကမာ -
“ ID “ နင႔ runat = “server” ဟေသာ အခက နစခ ပင ျဖစသည ။
Function Control Name ID
စာ မား ေဖၚျပရန Label lbl
စာ မား ျပငရန TextBox txt
List တစခမ ေရြးခယရန DropDownList
ListBox
ddl
lst
ပမား ျပရန Image
Adrotator
img
adr
တနဖး တစခက ေရြးခယရန CheckBox
Radio Button
chk
rbut
ေန႔ရက အခနမား ေဖၚျပရန Calendar cld
Command ေပး ခငးေစရန Button
LinkButton
ImageButton
but
lnkbut
imgbut
အေၾကာငးအရာ တစခ ႏင႔ ခတရန HyperLink hylnk
အပစ ဖြ႔ထားေသာ Controls မား CheckBoxList
Panel
RadioButtonList
chklst
pnl
rbutlst
ဥပမာ ။ ။
User Name က ရကထည႔ရန အသးျပေသာ TextBox Control အတြက ေအာကတြင ေဖၚျပထားသည႔ အတငး
သးရမည ျဖစသည ။
<asp : TextBox ID=”txtUserName” runat=”server” ></asp:TextBox>
DropDownList Control က အသးျပပါကလညး ေအာကတြင ေဖၚျပထားသည႔ အတငး သးရန
<asp:DropDownList ID=”ddlUser” runat=”server “ > < /asp:DropDownList >
2.2 Asp.net Special Folders
Asp.Net ရ႔ web site ထမာ Special Folders ေတြက အခလပ သတမတထားပါတယ ။
1 . App_Code
2 . App_Theme
3 . App_Data
4 . App_GlobalResources
5 . App_LocalResources
6 . App_WebReferences
7 . App_Browser
8 . Bin စသညတ႔ ျဖစပါတယ ။
2.3 Data Bound Controls
Data Bound Controls ေတြ အသးျပခငရင DataSource န႔ DataBind( ) တ႔ မျဖစမေန ပါရမာ ျဖစပါတယ ။
Data Bound Controls အေရအတြက အားလး ၁၂ မး ရပါတယ ။
1. GridView
2. TreeView
3. DropDownList
4. BulletedList
5. DetailsView
6. CheckBoxList
7. RadioButtonList
8. ListBox
9. DataList
10. AdRotator
11. Menu
12. Repeater စသည တ႔ ျဖစပါတယ ။
2.4 Tracing Key
Trace လကရာတြင အသးျပေသာ Key မားက စစညး ေဖၚျပေပးထားပါသည ။
Command (Hot Key) Description
F9 Trace လကလေသာ ေနရာတြင Break Point ေထာကထားရန F9 က အသးျပသည ။
Step Into (F11) Trace လကေသာအခါတြင တစေၾကာငးခငး၀င အလပလပပက ၾကည႔ရန သးသည ။
Step Over (F10) Trace လကေသာအခါတြငတစေၾကာငးခငးလကခငးမးမဟတပ မနေသာ အဆင႔မား
က ေကာထားခ႔ျပး အလပလပပက ၾကည႔ရန သးသည ။
Continue (F5) Trace လကေသာအခါတြင Brake Point ေနရာသ႔ ေရာကရန F5 က နပပါ ။
Delete All Break Points
(Ctrl+Shift+F9)
Application တစခလး အတြငးရ Break Points အားလး ျဖတလလငသးသည ။
CHAPTER 3
3.1 Data Types
ေအာကတြင ေဖၚျပထားေသာTable အတြငးရ အ၀ါေရာင Data Types မားက မတသားထားရန လအပသည ။
Data Type Long Form Storage Size Range
Int System.Int32 4 bytes –2147483648 to 2147483647
Long System.Int64 8 bytes –9223372036854775808 to
9223372036854775807
Byte System.Byte 1 byte 0 to 255
Float System.Single 4 bytes –1.5x10-45 to 3.4 x x1038
Double System.Double 8 bytes –5.0x10-324 to 1.7x10308
Decimal System.Decimal 12 bytes 1.0x10-28 to 7.9x1028
Char System.Char 2 bytes Unicode character
Boolean System.Boolean 1 byte True or false
String System.String 2 bytes * char count Unicode characters
3.2 Variable Declaration and Assign
MyVariable ဆေသာ string Data Type က အရငေၾကျငာျပးမ “Hello World” ဆေသာ string တစေၾကာငးက
MyVariable ထသ႔ ထည႔ပ
string MyVariable;
MyVariable = "Hello World!";
MyVariable ဆေသာ string Data Type ေၾကျငာျပးေနာက “Hello World” ဆေသာ string တစေၾကာငးက
MyVariable ထသ႔ တကရက ထည႔ပ
string MyVariable = "Hello World!";
Data Type တစခ၏ေနာကတြင Variable မားစြာ ေၾကျငာ အသးျပနငသည ။
int A, B, C ;
Data Type တစခ၏ေနာကတြငVariable မားစြာ ေၾကျငာနငရသာမက တနဖးကပါ တကရက ထည႔သြငးနငသည။
int A = 9, B = 7;
3.3 Constructor
Function Name တစခသည Class Name နင႔ တညေနျပး return type မပါ၀ငလင Constructor အျဖစ
သတမတ နငသည ။ Constructor နစမး ရသည ။
1. Default Constructor
2. Argument Constructor
Default Constructor သည argument ပါ၀ငေလ႔မရ ။ public class Sample
{
public Sample()
{
}
}
Argument Constructor သည Default Constructor နင႔ သေဘာတေသာလညး Argument Constructor
ထတြင argument မား ပါ၀ငလာေလ႔ ရသည ။ public class Sample
{
public Sample(argument)
{
}
}
3.4 Method and Parameters
Parameters မပါေသာ Method protected void Page_Load(object sender,EventArgs e)
{
SetPageTitle();
}
void SetPageTitle()
{
this.Page.Title= “ Test Page”;
}
Parameters ပါေသာ Method
private int AddNumbers ( int A , int B)
{
return A + B ;
}
3.5 Operators
သထားရမည႔ Operators မား ျဖစသည ။
Primary x++ x-- x++ အလပလပျပးလင x တနဖး က ၁ တးမည ။ x-- အလပလပျပးလင x တနဖး က ၁ ေလာ႔မည ။
Unary ++x --x ++ x အလပမလပခင x တနဖး က ၁ တးမည ။ --x အလပမလပခင x တနဖး က ၁ ေလာ႔ မည ။
Multiplicative * / % * အေျမာက / အစား % အၾကြငးရလာဒ တြကရန
Additive + - + အေပါငး - အနတ
Shift << >> << ဘယေရြ႔ >> ညာေရြ႔
Relational < > <= >= < ငယ > ၾကး <= ငယလငညလင >= ၾကးလငညလင
Equality = = != = = ( တလင ) != ( မတလင)
Conditional AND && အေရ႔ နင႔ အေနာက အေျခအေန နစခလး အတြက
Conditional OR || အေရ႔ သ႔မဟတ အေနာက အေျခအေန တစခခ အတြက
Conditional c?x:y c မနလင x အလပကလပျပး မားလင y အလပကလပသည ။
Assignment = += -= *= /= တကရက Assign လပလလင သးသည ။
3.6 Function and Variable Scope
Declared Meaning
Public မညသည႔ Class က မဆ ေခၚယ အသးျပနငသည ။
Protected သကဆငရာ Class တစခမ Inherit လပထားေသာ Class က သာ ေခၚယ အသးျပနငသည ။
Private Class တစခ အတြငးတြငသာ အသးျပနငသည ။
3.7 C# Data Type Convertions
Data Type တစခ မ တစခ သ႔ ေျပာငးလရန နညးလမး ( ၃ ) မး ရပါသည ။
အ၀ါေရာင ျပထားေသာ ေျပာငးပေျပာငးနညး နညးလမးမား က အသးျပနငသည ။
int A = 10;
double dblA;
dblA = (double)A;
int intA = 10;
string strA;
strA = Convert.ToString(intA);
intA = Convert.ToInt32(strA);
int intA;
string strA = "10";
// Convert the string "10" to the numeric value 10.
intA = Int32.Parse( strA ) ;
3.8 Statements
3.9 Loops
Statements နင႔ Loops မား အေၾကာငးက အရင ေရးသားထားေသာ “C# Programming FundamentalsC# Programming FundamentalsC# Programming FundamentalsC# Programming Fundamentals”
ျမနမာျပန EBook တြင ျပနလည ေလ႔လာ နငပါသည ။
CHAPTER 4
4.1 Validators
1. Require Field Validator
2. Range Validator
3. Regular Expression Validator
4. Compare Validator
5. Custom Validator
6. Validation Summary
1.Require Field Validator
User တစေယာကအား Control ထသ႔ Data မထည႔မေသာအခါ သတေပးရနအတြက အသးျပသည ။
Require Field Validator Control ၏ အသးမားေသာ Properties မား
- ControlToValidate
- ErrorMessage
- Text
2.Range Validator
User တစေယာကအား သတမတထားေသာ အတငးအတာအတြငးတြငသာ Data ထည႔ရန သတေပးလေသာ အခါ
အသးျပသည ။
လတစေယာက အသကသည 1 to 110 တြငးသာ ရရမည ။
Range Validator ၏ အသးမားေသာ Properties မား
- ControlToValidate
- ErrorMessage
- Minimum
- Maximum
- Type
- Text
- Operator
3.Regular Expression Validator
စနစတက သတမတထားျပးေသာ Email က႔သ႔ ပစမား စစရန အတြက အသးျပသည ။
Email လပစာ တြင “@” Sign မျဖစမေန ပါ၀ငရမည ။ ( [email protected] )
Regular Expression Validator ၏ အသးမားေသာ Properties မား
- ControlToValidate
- ErrorMessage
- ValidationExpression
- Text
4.Compare Validator
တနဖး တစခ နင႔ တစခ ၊ Control တစခနင႔တစခ နငးယဥရာတြင အသးျပသည ။
Password နင႔ Confirm Password တ႔က စစရာတြင အသးျပနငသည ။
Compare Validator ၏ အသးမားေသာ Properties မား
- ControlToValidate
- ControlToCompare
- ErrorMessage
- Text
5.Custom Validator
မမကယပငေရးသားရျခငးျဖစျပး ရျပးသား Validator Control မားနင႔ မလေလာကေသာအခါ အသးျပသည ။
Custom Validator ၏ အသးမားေသာ Properties မား
- ControlToValidate
- ErrorMessage
- ClientValidationFunction
- Text
Event
- ServerValidate
6.Validation Summary
Validation စစရာမ ရရလာေသာ ErrorMessage မားက တစေနရာတညးတြင စစညးေဖၚျပရန အတြက အသးျပသည ။
4.2 Web User Control, Custom Control, Composite Control
Web User Control
-------------------------
1 . WebSite ထတြငသာ ေရးသားရသည ။
2 . ascx ဖင အမးအစားက ယ ေရးရသည ။
3 . No DLL ( DLL = Dynamic Link Library မထြကပါ )
4 . အသးျပလေသာ Web Page ေပၚသ႔ User Control က တကရက ဆြတင အသးျပနငသည ။
Custom Controls
----------------------
1 . Project ထတြင ရေသာ Class Library တြင ၀ငေရးရသည ။
2 . ဖင အမးအစားသည .cs ဖင အမးအစား ျဖစသည ။
3 . DLL ဖင ထြကသည ။ ထ႔ေၾကာင႔ Visual Studio 2005/2008 တ႔၏ ToolBox တြင ထည႔သြငး အသးျပနငသည ။
4 . အသးျပပမာ Asp.Net Control မား က႔သ႔ပင ျဖစသည ။
Composite Controls
--------------------------
Custom Control က႔သ႔ျဖစျပး Asp.net Controls မား တစခထကပ ေပါငးစပေရးသားထားေသာ Control ျဖစသည ။
1 . Project ထတြငရေသာ Class Library တြင ၀ငေရးရသည ။
2 . ဖင အမးအစားသည .cs ဖင အမးအစား ျဖစသည ။
3 . DLL ဖင ထြကသည ။ ထ႔ေၾကာင႔ Visual Studio 2005/2008 တ႔၏ ToolBox တြင ထည႔သြငး အသးျပနငသည ။
4 . အသးျပပမာ Asp.Net Control မား က႔သ႔ပင ျဖစသည ။
CHAPTER 5
5.1 State Management Technologies
Client Side State Management တြင Cross Page လညး ပါ၀ငသည ။
CHAPTER 6
6.1 ADO.Net
ADO.NET သည Data access နညးပညာတစခ ျဖစျပး Connected Approach နင႔ Disconnected Approach
ဆေသာ နညးလမး ႏစမး ရပါတယ ။
Connected ApproachConnected ApproachConnected ApproachConnected Approach တြင ပါ၀ငေသာ Object ေလးမးမာ
- Connection Database နင႔ ခတဆကရန
- Command Database က Connection Object နင႔ တြကာ ခငးေစရန
Command က ေလးမး ထပခြ နငသည ။
ExecuteNonQuery( )
Return Value မရ ။
INSERT, UPDATE, or DELETE တ႔အတြကသးသည ။
ExecuteReader( )
Database Query တစခမ Result Set က Return ျပနေပးသည ။
DataReader object သေဘာတရားပင ျဖစသည ။
SELECT အတြကသးသည ။
ExecuteXMLReader( )
XML File မားက ဖတရန အသးျပသည ။
ExecuteScalar( )
Database query တစခ မ Return ျပနလာေသာ Single value တစခက
လကခရန အသးျပသည ။
- DataReader Data Reader သည Forward-Only , Read-Only ျဖစသည ။
- DataAdapter Connected Approach ထတြင ထည႔သြငး ေရးသားထားေသာလညး
တကယတမး DataAdapter သည Disconnected Approach ထတြင
ရေသာ DataSet နင႔ သာ ခတဆက အလပလပေပးသည ။
DataAdapter ထတြငပါ၀ငေသာ Fill ( ) Method ျဖင႔ DataSet ထသ႔
Database မ Data မား ထည႔သြငး နငရန ကညေပးသည ။
Disconnected Approach ( DataSet )
DataSet ဆသညမာ DataTables စစညးထားသည႔ သေဘာျဖစသည ။