Title: Visual Basic 2005?????
1CH08
2??? ????
3ADO.NET???????
?????
?????????????,?????????????????--????????
?????????,?????????????,??????????????????
?,??????????? ??????????????????(???????)?
?,???????????????????????????????????????????,????
?????????Binary Code,????????????????,????????????
??? ?????????????????,????????(???????)???
????????????
4ADO.NET???????
????????????????,????????????(??????1999??????????
?)?????????????Access?SQL Server?Oracle???????????
??,?????????????
?????
???????????????,??????????????????,???????(??????
)????????????????????????
5ADO.NET???????
?????
??????????,?????????(????????),????????????????? ?
?,???????????(???????????????????)
6ADO.NET???????
??,???????,?????,??????????????,????Excel?sheet,??
???????????????????????????,??????????????????????
???
?????
???????,???????
??,?????????????????????????????,?????????????????
?,???????????????????????
?????????,????????(Data Column)
???????????????(Data Row)
7ADO.NET???????
?????
?????????????????????,?????????????,?????????????
????????????5000????????(?????????????????????????
)
???????????????????,?????????????
8ADO.NET???????
????VB.NET???????
????????????????,?????????????????????????????????
????,??????????????SQL??,?????????????????SQL?????
???????,????????????????????
??,Visual Basic 2005?????,???????????,????????????
?,??????????,?????????????????????????,????????,??
?????????,?Visual Basic 2005??????,????????????,??
???????????????,???????,??????????????????
9ADO.NET???????
????VB.NET???????
????????????????,???TextBox?Label,?????ToolStrip(?
??)?????????????????????????,????????????????????,
?????????????????????,?????????
10ADO.NET???????
????VB.NET???????
?????VS2005??????????,???????????????????????,????
????????,????????????
11ADO.NET???????
??SQL??
???????,???????????SQL??,????????????????????????,
???????SQL Server 2005 Express?????,????????????
Select??
?????????Select??,???????????????????,????????????
??,??????,????????????(???????)????(view)?
??
12ADO.NET???????
Select??
????????,????????SQL??????(CH08-01)?,????TextBox??
??Select??,?????????,???????????DataGridView?
???Select??,???????????????VB????,????View,??DataG
ridView?????
13ADO.NET???????
Select??
Select?????????,?????Select???????Order By
????,????????????
????????????(???????????????,??????????),????????
?
14ADO.NET???????
Select??
Order By????????,???,???,??????????Asc?Desc,??????
?????????(Asc)??????(Desc),?????,?Asc?????
??????????????,???????SQL??,??????????????????,???
???????,?????????????????
15ADO.NET???????
Select??
??Order By??,Select??????????????,?????Where??????
?????????????
16ADO.NET???????
Select??
???????????,??????Like???,?????????,??
??????Like????,??????????,???????,??????,??????
like '?'?????,???????????????????,??????????????
???,????????????,???????????????????,?????????
17ADO.NET???????
Insert??
??????,?????????,???????,??????????
??
???,?SQL????,?????????????????????
??????????????,?????
18ADO.NET???????
Delete??
Delete??????????,???????????,?????????????,?????
???Where??????Select????,??And, Or,
??Like????,?????????,??????????????,??
???????,????????????????????????????,???????
???where??,?????????,???????????????????
19ADO.NET???????
Update??
Update???????????????,?????
?Delete????,?????Where??,?????????????????????????
?(???????????Set????)? ????????????????, ?????????
??, ??????????????
20ADO.NET???????
Update??
???????
??Boolean??,??Yes?No????(???1?0)???
?????????????????(??????????,??????????)
21ADO.NET???????
Update??
???????
??Boolean??,??Yes?No????(???1?0)???
??????,??????????5?????????????????????????????
22ADO.NET???????
Update??
???????
??Boolean??,??Yes?No????(???1?0)???
?????????????10???,??????,????????????????????????
23ADO.NET???????
????VB????????
????SQL Command
DataGridView
?????Select SQL Command?????(Data
View)?????DataGridView???
CH08-03??
24ADO.NET???????
??DbAccess???????
?????????SQL Server 2005 Express????
??TextBox??Select??,????????DataTable?
25ADO.NET???????
??DbAccess??????????
????????SQL??
26ADO.NET???????
??DbAccess???ADO.NET?????
?????DbAccess????????????????,???????DbAccess?????
???????????,????????????????DbAccess????? ????????
?DbAccess???????? ????????????DbAccess????????????
??,??????????DataTable,???????,????DataTable?????,
????????????????????? ?.NET Framework??,??????????
ADO.NET??,ADO.NET??????????????????,??????????????
??????????????????????(???),??????????????????? ??
???????DataTable,??ADO.NET?????????
27ADO.NET???????
DataTable?DataRow??
28ADO.NET???????
????????????
cNorthWind.MDF
ShowData(ByVal id As Integer) ??N?????????
29ADO.NET???????
30ADO.NET???????
???????????????
cNorthWind.MDF
ToolStrip_btn_Save.Click
31ADO.NET???????
32ADO.NET???????
33ADO.NET???????
????????????
cNorthWind.MDF
ToolStrip_btn_Delete_Click
34ADO.NET???????
???????????,???????????????????,???????SQL????????
35ADO.NET???????
??????
??????????????????,??????,????????????????? ?????,
????????????,?????????,????Insert??,??????????????
?? ?????????????
36ADO.NET???????
37ADO.NET???????
????
?????????????????,?????????????????,???????? ?????
??????,?????????????????,?????????,????????ShowDat
a?????????,???????????
38ADO.NET???????
????
cNorthWind.MDF
btn_search_Click (Search.vb)
39ADO.NET???????
40ADO.NET???????
41ADO.NET???????
????????????
42ADO.NET???????
?????????
getByte????image??(???????) ,?????Byte()??(?????
??),????????image????????
43ADO.NET???????
???? ????????
44ADO.NET???????
DbAccess??
????,?????DbAccess????????????????,???????DbAccess
????????????????,????????????????DbAccess?????
45ADO.NET???????
ADO.NET?????????
46ADO.NET???????
ADO.NET???????????(????????)
47ADO.NET???????
ADO.NET???????????
Data Source?????????,?????????SQL
Express???,????????AttachDbFilename?????? Integrat
ed Securitytrue???????????????????,??????,??????
????????????????
ADO.NET???????,????????,??????????????????????????
????
48ADO.NET???????
SqlDataAdapter???????????(conn)?????SQL??,??Fill??
,??????(DataView)??dt
??DataAdapter?????
??SqlDataAdapter???Fill?????SQL??(?????????conn???
??????????????),??????????,????????????,????DataT
able????????????????
49ADO.NET???????
???????????????,???DataCommand????????DbAccess????
,???ExecuteCmd??Method????
??DataCommand???SQL??
??????ExecuteCmd????????
50ADO.NET???????
8-5-3 ??DataCommand???SQL??
????????6-21?,??????SqlCommand??,??SQL???????????P
rivate????????Conn,?????(?SQL?????_at_...??????)????p
arameter????8????SqlCommand(dc)????,?????SqlComman
d???ExecuteNonQuery???????SQL???
51ADO.NET???????
???????
??.NET??????????????,???????????????????.NET????,?
???????????,?????????????????????,??????Windows???
????????????? ???XML???,????????????????????????,?
???????,?ADO.NET??XML????,????ADO?????????.NET
Framework??ADO.NET,?WEB???????????,???????????????
????ADO.NET?ADO?????????????,????????????????? ???
??????????????????,?????????????????,?????????????
?????????(????????????),?????????????????????????
,????,?????MSN?Skype???P2P????,???????????????????
?????????????????????????????????????????(???????
?????????,MSN?????????????),???????,???????,??????
????????,??????????????
52ADO.NET???????
???????
?????????(????)?????????????,??????????????,??????
????????? ????ADO.NET?????DataTable??(??DataSet??)
??????????????????????????????????,??????????(????
??????????..)?????????,???????????????????????????
,???????????? ???ADO.NET??????????SOA ( ??????
Service-Oriented Architecture)???????,????????????
????DataTable?,???WebServices??,?????????????(????
?????),??????????????? ????,????????????,???????ED
I??(??????)??SCM(?????)??,?????????,??????????????
,?????????????