¤ÀÃþ |
¼ÐÃD |
¤j·N |
§@ªÌ |
¤é´Á |
SQL »yªk | ¨âÄæ¸ê®Æ¦X¦¨¤@Äæ | Alias As ±Ôzªº¥\¯à | ¦Ñ©Ç | 1998/8/1 |
SQL »yªk | ¦hÄæÃöÁp¤Î¯Á¤Þ | Alias As ±Ôzªº¥\¯à | ¦Ñ©Ç | 1998/7/18 |
SQL »yªk | ¦bSQL¤¤¨Ï¥Î¦Ûq¨ç¼Æªº°ÝÃD | ¡@ | ¦Ñ©Ç | 1998/7/18 |
SQL »yªk | Á`p¬d¸ßªº SQL »yªk | GROUP & HAVING | ¦Ñ©Ç | 1998/9/3 |
DAO ¾Þ§@ | §PÂ_¬Y¤@ÓTABLE¬O§_¦s¦b | TableDefs ª«¥óªº¨Ï¥Î | Rose | 1998/7/3 |
DAO ¾Þ§@ | ¶i¤J¥[±K¸ê®Æ®w | WorkSpace.OpenDatabase() | ¦Ñ©Ç | 1998/8/2 |
DAO ¾Þ§@ | ³¡¥÷¦r¦ê·j´M | FindFirst & Like | ¦Ñ©Ç | 1998/8/7 |
DAO ¾Þ§@ | ¨ú¥X¤Î¦^¶ñÄæ¦ìÈ | Field.Value ªº¨Ï¥Î | ¦Ñ©Ç | 1998/8/7 |
DAO ¾Þ§@ | §PÂ_¬O§_§ä¨ì²Å¦Xªº°O¿ý | EOF & BOF & AbsolutePosition | ¦Ñ©Ç | 1998/8/10 |
DAO ¾Þ§@ | ¦b¬J¦sªº¸ê®Æªí·s¼WÄæ¦ì | TableDef & Field ª«¥ó¨Ï¥Î | ¦Ñ©Ç | 1998/8/18 |
DAO ¾Þ§@ | Dao ªº¾ã§å¥æ©ö°Ê§@(Transaction) | WorkSpace ª«¥óªº¨Ï¥Î | ¦Ñ©Ç | 1998/8/18 |
DAO ¾Þ§@ | ¦V MDB ¸ê®Æ®w¥[¤G¶i¦ì¸ê®Æ | ¥Î AppendChunk ÆZ·F | ¦Ñ©Ç | 1998/8/21 |
DAO ¾Þ§@ | ¤å¦rÀɸê®Æ®wªº¶}±Ò¤è¦¡ | Ý½× Text ªº ISAM | ¦Ñ©Ç | 1998/8/30 |
DAO ¾Þ§@ | DBGrid¤¤¦p¦ó±oª¾¥Ø«e©Ò¦bªº°O¿ý¦ì¸m | AbsolutePosition ÄÝ©Ê | ¦Ñ©Ç | 1998/9/1 |
DAO ¾Þ§@ | ±N MDB Table ¿é¥X¦¨¤å¦rÀÉ | Dao »P File I/O ¦X§@ | ¦Ñ©Ç | 1998/9/1 |
DAO ¾Þ§@ | bookmark ¦p¦ó°µÅÞ¿è§PÂ_ | ByteArray ªºÂà´« | JeffLin | 1998/9/2 |
DAO ¾Þ§@ | ¦Û»s¦Û°Ê½s¸¹Äæ¦ì | ¡@ | ¦Ñ©Ç | 1998/9/3 |
DAO ¾Þ§@ | ¦ü¬O¦Ó«Dªº RecNo | AbsolutePosition | ¦Ñ©Ç | 1998/9/5 |
DAO ¾Þ§@ | ¦b VB ùØÀ£ÁY MDB ¸ê®Æ®w | CompactDatabase | ¦Ñ©Ç | 1998/9/5 |
DAO ¾Þ§@ | ¥Î VB ¶} Excel Sheet ªí | ¡@ | ¦Ñ©Ç | 1998/9/9 |
¸ê®ÆÆ[©À | ¦p¦ó³W¹º Foreign Key | ¸ê®ÆªíªºÃöÁp | ¦Ñ©Ç | 1998/8/5 |
¸ê®ÆÆ[©À | ¤@¹ï¦h»P¥ª¥k³s±µ | ¸ê®Æªíªº³s±µ | ¦Ñ©Ç | 1998/9/11 |
¸ê®ÆÆ[©À | ¦hªí¬d¸ßªº³´¨À | ¥|³B®I¥ñªº Null È | ¦Ñ©Ç | 1998/9/11 |
Bee ¼¶¼g©ó¤å³¹
§Úªº¸ê®Æ®w¤¤¦³¤@Äæ¬OÁ`»ù,µ¥©ó³æ»ùÄæ*¼Æ¶qÄæ, ½Ð°Ý¨º¤@¬qÅýÁ`»ù¦Û°Êºâ¥Xªºµ{¦¡½Xn©ñ¦b¨º¸Ì(©Î¨ºÓ¨Æ¥ó¤¤)> ¤~¥i¥HÅýUSER¦b¿é¤J§¹³æ»ù©M¼Æ¶q«á´N±o¨ìÁ`»ù?
¦Ñ©Çµª¡G
¨ä¹ê¦XpÄæ¦ì¥Î SQL »yªk¨ú¥N¡A·|§ó¬ÙºÏºÐªÅ¶¡¡A¤]§ó¤è«K¾Þ§@¡A§A°Ñ¬Ý¤U¦C¦¡¤l¬Ý¬Ý¡C
SELECT Good.GoodID, Good.GoodName, Good.Unit, Good.Price, [Unit]*[Price] AS ¦Xp FROM Good;
»¡©ú¡G
- [¹Bºâ¦¡] As [Äæ¦ì¦WºÙ] ¡A´N·|§â¹Bºâ«áªºÈÂ\¦bµ¹©w¦WºÙªº¨ºÓ·sÄæ¦ìùØ¡A¦n¹³§A·s¼WÓÄæ¦ì¤@¯ë¡C
- [Äæ¦ì¦WºÙ] As [¥t¤@¦WºÙ] ¡A§@¥Îµ¥©ó Field.Name ¹ï Field.Caption ªºÃö«Y¡A¤]´N¬O Name ¬O©T©wªº¡A¦ý Caption ¥i¥H¨Ì»ÝnÀH®É§ï¡C
Option Explicit
Dim Ws As Workspace
Dim Db As Database
Dim Rs As Recordset
Private Sub Form_Load()
Set Ws = DBEngine.Workspaces(0)
Set Db = Ws.OpenDatabase("DBName", False, False, ";pwd=SecretString")
Set Rs = Db.OpenRecordset("RecordsetName")
Set Data1.Recordset = Rs
End Sub
±H¥óªÌ: ¥[µá
¥D¦®: [Database] ¦ó¿× Foreign Key ?
¦Ñ©Çµª¡G
SearialID | ForeignId | Date |
---|---|---|
I00001 | A20 | #1998/08/01# |
I00002 | A20 | #1998/08/02# |
I00003 | A20 | #1998/08/03# |
I00004 | A23 | #1998/08/01# |
I00005 | A23 | #1998/08/02# |
I00006 | A25 | #1998/08/03# |
SearialID | GoodName | Price |
---|---|---|
A20 | ¥¤ªo³J¿| | 300 |
A23 | °_¥qÄÑ¥] | 20 |
A25 | ²Î¤@¤j¿N¥] | 15 |
¹ï¿ù³£¬O¬°¤F·R ¼¶¼g©ó¤å³¹
°²¦p»¡¬Y¤@ÓÄæ¦ìªº¤º®e¬O¡G
- ¥xÆW·L³n¤½¥q
- ^¥Nº¸¤½¥q
- ¥xÆW IBM
n¦p¦ó¦b·j´M®É¥u¥´¤J"·L³n"´N¥i¥H§â¨º¤@µ§¸ê®Æµ¹§ì¥X¨Ó¡H
¦Ñ©Çµª¡G
YourRecordset.FindFirst "FieldName Like '*·L³n*'"
Boring Summer ¼¶¼g©ó¤å³¹
½Ð°Ý¦p¦ó¦bVB³s¨ì¸ê®Æ®w«á¡A±N¸ê®Æ®w¤¤ªº¸ê®ÆÂ^¨ú¥X¨Ó¹Bºâ¡A¤]´N¬O§â¸ê®ÆŪ¨ìÅܼƤ¤¡AµM«á¹ïÅܼƧ@¹Bºâ¡I¡I
¦Ñ©Çµª¡G
Public Function CheckTableExist(tData As Database, TableName As String) As Boolean
Dim I As Integer
CheckTableExist = True
For I = 0 To tData.TableDefs.Count - 1
If UCase(tData.TableDefs(I).Name) = UCase(TableName) Then
CheckTableExist = False
Exit Function
End If
Next I
End Function
½÷¥J on July 13, 1998
½Ð°Ý«ç¼Ëmake Relation between two field but not one field
¦Ñ©Çµª¡G
¥Î¤TÓ QueryDef ¨Ó¹F¦¨
1.Addfield1:
SELECT [Fdate]+[Ftime] AS JoinKey, RD01.Fdate, RD01.Ftime, RD01.Level
FROM RD01
ORDER BY [Fdate]+[Ftime];
2.Addfield2:
SELECT [Fdate]+[Ftime] AS JoinKey, MRD01.Fdate, MRD01.Ftime, MRD01.MLevel
FROM MRD01
ORDER BY [Fdate]+[Ftime];
3.AddAllField:
SELECT AddField1.Fdate,
AddField1.Ftime, AddField1.Level, AddField2.Fdate,
AddField2.Ftime, AddField2.MLevel
FROM AddField1 INNER JOIN AddField2 ON
AddField1.JoinKey = AddField2.JoinKey;
Smith ¼¶¼g©ó¤å³¹
½Ð°Ý¦p¦ó¦b¤@Ó¤w¦s¦bªºtable¤¤¦A¥[¤W¤@Ófield(Äæ¦ì)©O
¦Ñ©Çµª¡G
Option Explicit
Dim Db As Database
Dim Tb As TableDef
Dim Fd As Field
Private Sub Form_Load()
Set Db = OpenDatabase("c:\user\mytest.mdb")
Set Tb = Db.TableDefs!Good
Set Fd = Tb.CreateField("YouPut", dbText)
Fd.Size = 20
'¥[¤JÄd¦ì
Tb.Fields.Append Fd
'§R°£Äæ¦ì
Tb.Fields.Delete "YouPut"
End Sub
Private Sub Form_Unload(Cancel As Integer)
Db.Close
End Sub
linus ¼¶¼g©ó¤å³¹
®Ñ¤W»¡Jet Engine¤ä´©Transaction Management,§Ú¥Îvb5+access 7.0 «o¸Õ¤£¥X¨Ó,(¨S¦³error,¦ý¬O³£¨S¦³µo¥Íupdate¤Îdelete)
¦Ñ©Çµª¡G
Option Explicit
Dim DJet As New DBEngine
Dim Wk As Workspace
Dim Db As Database
Dim Rs As Recordset
'§¹¦¨¾ã§å¥æ©ö
Private Sub Command1_Click()
'¦pªG Rs ª«¥ó¤£¤ä´©¾ã§å¥æ©ö«hµ²§ô Sub
If Not Rs.Transactions Then Exit Sub
Rs.MoveFirst
Wk.BeginTrans
Do While Not Rs.EOF
Rs.Edit
Rs.Fields(2).Value = "123"
Rs.Update
Rs.MoveNext
Loop
Wk.CommitTrans
End Sub
'´_ì¾ã§å¥æ©ö
Private Sub Command2_Click()
'¦pªG Rs ª«¥ó¤£¤ä´©¾ã§å¥æ©ö«hµ²§ô Sub
If Not Rs.Transactions Then Exit Sub
Rs.MoveFirst
Wk.BeginTrans
Do While Not Rs.EOF
Rs.Edit
Rs.Fields(2).Value = "456"
Rs.Update
Rs.MoveNext
Loop
Wk.Rollback
End Sub
Private Sub Form_Load()
Command1.Caption = "Commit"
Command2.Caption = "Rollback"
Set Wk = DJet.Workspaces(0)
Set Db = Wk.OpenDatabase("c:\user\mytest.mdb")
Set Rs = Db.OpenRecordset("Good")
'¨S¦³°O¿ý«hµ²§ô
If Rs.EOF And Rs.BOF Then
Unload Me
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Rs.Close
Db.Close
Wk.Close
End Subnª`·Nªº¬O¦b BeginTrans ¤§«e¡ARs n¥ý MoveFirst ¡A§_«h§Aªº record ¦pªG¦b Eof ¡A·íµM¨S°µ´Nµ²§ô¤F¡C
ⶳÃM ¼¶¼g©ó¤å³¹
¦³¤@Ó¦Ûq¨ç¼Æ backsum()
public function backsum()
.......
end function
°²¦p°õ¦æ:
sql1="select backsum as BCCT from tablemname"
µ²ªG²£¥Í backsum ¨ç¼Æ¥¼©w¸qªº¿ù»~¡A¦p¦ó¤~¯à¥¿½T¡H
¦Ñ©Çµª¡G
sql1="select " & backsum() " as BCCT from tablemname"
powerboy
¦p¦ó¥Î VB ¦V Access ²K¥[¤G¶i¨î¤å¥ó¡A¦p²K¥[¤@ Zip ¤å¥ó¨ì Access ?
¦Ñ©Çµª¡G
¦Ì©_ ¼¶¼g©ó¤å³¹
§Ú¥ÎData»PDBGrid¨â±±¨î¶µ±ýª½±µ¶}±Ò¤@¤å¦rÀɽT¥X²{³o¼Ëªº°T®§...."§ä¤£¨ì¥i¦w¸ËªºISAM "§Ú¬Ý¤F¬Ý»¡©úÀɬÛÃöªº¤º®e....·N«ä¦n¹³¬On¥hregedit¤¤°µ×§ï...¡H¡H ¬O¶Ü¡H ¨ºn«ç»ò°µ©O¡H¡H
¦Ñ©Çµª¡G
¨«¹L¥|¤è¦^¨ììÂI ¼¶¼g©ó¤å³¹
·í§Ú²¾°ÊTable¤¤½bÀY«ü¦V¨ä¤¤¤@Ó°O¿ý®Én¦p¦ó±oª¾¥Ø«e¦¹°O¿ý¬O²Ä´Xµ§°O¿ý©O¡H¤S·í§Ú§Q¥Î·j´Mªº¤èªk¥h§ä²Å¦X¬YºØ±ø¥óªº°O¿ý®Én«ç¼Ë¤~¯à±N«ü¼Ð«ü¦V¦¹¤@°O¿ý¨ÃÅã¥Ü¦b¥HDBGrid§@¥X¤§table¤W©O¡H¡H
¦Ñ©Çµª¡G
- Option Explicit
'½Ð¦b Form ¤W¥¬¸m Command1,Data1,DBGrid1,
'¨ÃÅý DBGrid.DataSource=Data1
Dim Db As Database
Dim Rs As Recordset
Private Sub Command1_Click()
'¦]¬°¦b Form_Load ùاÚ̥ΠSet Data1.Recordset=Rs
'¨Ï Data »P Rs ³s°Ê¡A©Ò¥H§A¥un°õ¦æ Find «ü¥O¡A
'DBGrid «ü¼Ð¦Û¤v·|¸õ¹L¥h
Rs.MoveFirst
Rs.FindFirst "Serial=3"
End Sub
Private Sub Data1_Reposition()
'ª`·N!!¥u¦³dbOpenDynaset or dbOpenSnapshot
'¤~¥i¥H¨Ï¥Î Rs.AbsolutePosition ªºÄÝ©Ê
'Recordset ªº²Ä¤@µ§°O¿ý¬O 0
'³oÓ±Ôz¯àÅý DataControl Åã¥ÜÁ`°O¿ý¤Î¥Ø«e°O¿ý«ü¼Ð
Data1.Caption = CStr(Rs.AbsolutePosition + 1) & "/" & Rs.RecordCount
End Sub
Private Sub Form_Load()
Set Db = OpenDatabase("c:\user\mytest.mdb")
Set Rs = Db.OpenRecordset("Student", dbOpenDynaset)
'§â Rs °O¿ý«ü¼Ð²¾¨ì³Ì«á¤@¦¸¡A°µ¥X¨Óªº Rs.RecordCount ¤~·|¥¿½T
Rs.MoveLast
Rs.MoveFirst
Set Data1.Recordset = Rs
End Sub- ½Ð¨Ì§A¦Û¤vªº¸ê®Æ®wª¬ªpקï¤W¨Ò¡C
¤p«e¾W ¼¶¼g©ó¤å³¹
ì¥ý¶}±Ò¤§*.mdbÀɤ¤ªº¸ê®Æªí¦³¦ó¸û§Ö³tªº¤èªk±N¸ê®Æ*.mdbÂà´«¦¨¤å¦rÀÉ??¦]¬°¤Wzªº¤èªk¹ê¦b¬O¤ÓºC¤F....¦pªG¸ê®Æ¶q¤j¡]¤W¤dµ§¡^>µ¥«Ý®É¶¡¯u¬O¤Ó¤[¤F»¡.....
¦Ñ©Çµª¡G
°íô ªº¤å³¹¤¤´£¨ì:
§Ú¥Î¤Fclassline_head ©Mclassline_tail¨âӼƳ]©w¦¨VariantµM«á°O¿ýdata1.recordset.bookmark ¦ý¬O·í§Ú¼g¨ì¤F while not data1.recordset.bookmark=classline_head ........ loop®É¹q¸£¦b°õ¦æ«á´N¸ò§Ú»¡¸ê®Æ«¬ºA¤£²Å.......
Jeff Lin 榭G
Bookmarkªº°ò¥»«¬ºA. Y¥Hvariant±µ¦¬, ¤@©w·|¦¬¨ìbyte array. µM¦Óbyte array¬O¤£¯àª½±µ¤ñ¸ûªº (¥ô¦óarray³£¤@¼Ë).«Øij±z©w¸q¬°string, ±µ¦¬¤§«á´N¥i¥H¤ñ¸û¤F.
¦Ñ©Ç´¡ªá¡G
ÃöÁp»P³s±µªºÃö«Y
¦b¦¹¦Ñ©Çn¸ò¤j®a½Íªº¬O¸ê®Æ®w¤¤¡AÃöÁp»P³s±µªºÃö«Y¡AÃöÁp»P³s±µ¨ì©³¦³¦óÃö«Y©O¡H¨ä¹ê¬O¤@¥ó¨Æ¡C´N¬O·í§Ú̥ΠDao CreatRelation ¤èªk«Ø¥ß¤@Ó Relation ª«¥ó¡A©Î SQL ±Ôz¤¤¥Î Join ±Ôz³s±µ¨âÓ Table ®É¡A´N²£¥Í¤F³oÓÃöÁp¤SºÙ³s±µª¬ºA¡A¥u¤£¹L¬°¤F°Ï§O¤è«K¡A§Ú̦h§â Relation ªº³]©w¥sÃöÁp¡A¦Ó§â SQL JOIN ±Ôz¥s³s±µ¡C
¤@¹ï¦h»P¥ª¥k³s±µ
¬JµMÃöÁp»P³s±µ¬O¤@¥ó¨Æ¡A¨º¦b Access 97 ½s¿èÃöÁpùسs±µÃþ«¬³]©w¤S¬O¤°»ò·N«ä¡A¤]´N¬O¤@¹ï¤@ÃöÁp©M¤@¹ï¦hÃöÁp¬O¥Ñ Join «¬ºA¨M©wªº¶Ü¡HInner Join ¬O¤@¹ï¤@¡HLeft Join ©M Right Join ¤~¬O¤@¹ï¦h¡H¨ä¹ê§¹¥þ¿ù¤F¡AÄÝ©óÃöÁpÃþ«¬ªº¤@¹ï¤@©M¤@¹ï¦h¡A©MÄÝ©ó³s±µÃþ«¬ªº¥ª¥k³s±µ§¹¥þ¬O¨â¥ó¤£¦PÄݩʪºªí²{¡A¦UºÞ¦Uªº¡A½Ö¤]¤£¤z¯A½Ö¡C
¤@¹ï¦h»P¤@¹ï¤@ªºÃöÁpÃþ«¬¦p¦ó³]©w
µª®×¬O¨Sªk³]©w¡A¦]¬°¬ÛÃöÁpªº¨â±i¸ê®Æªí¡A¥DÃöÁp¸ê®ÆªíªºÃöÁpÄæ¦ì¥²¶·¬O±©¤@ÁäȪº¯Á¤ÞÄæ¡A¦pªG³QÃöÁp¸ê®ÆªíªºÃöÁpÄæ¦ì¤]¬O±©¤@ÁäȪº¯Á¤ÞÄæ¡A¨º³oÃöÁp´N¬O¤@¹ï¤@¡A¦Ó¦pªG³QÃöÁpÄæ¦ì¨Ã«D±©¤@ÁäÈ¡A¨º¨âªÌÃöÁp´N¬O¤@¹ï¦h¡C¤]´N¬O»¡ÃöÁpÃþ«¬¨M©w©ó¿ï¥Î¨º¨âÓÄæ¦ì°µÃöÁp¤§®É¡C
¥ª¥k³s±µªº§@¥Î
§Aªº JOIN ¤£ºÞ¬O INNER ¡BLEFT or RIGHT ¡A³£¤£·|¹ï¤@¹ï¤@©Î¤@¹ï¦hÃöÁpÃþ«¬²£¥Í¥ô¦ó¼vÅT¡A¥¦ªº§@¥Î¬O¥u¦³¦b¥DÃöÁp¸ê®Æªí¤Î³QÃöÁp¸ê®Æªí¤¤¡A¯Á¤ÞȤ£¦¨¹ï¥X²{®É¤~¦³§@¥Î¡C¤]´N¬O»¡·í¥DÃöÁp¸ê®Æªí¤¤¦³¨ÇÃöÁpÁäȦb³QÃöÁp¸ê®Æªí¤¤§ä¤£¨ì¡A©Î¬O±¡ªp¤Ï¹L¨Ó¡A³o®É¨º¨Ç¯Ê¤@Ã䱡§ÎªºÄæ¦ìȬO§_n§e²{¡A´N¥Ñ INNER ¡BLEFT or RIGHT ¨M©w¡C
½d¨Ò»¡©ú¡G
¥DÃöÁp¸ê®Æªí
MasterID Note 1 M_Rec_1 2 M_Rec_2 3 M_Rec_3
³QÃöÁp¸ê®Æªí
SuBID MasterNo Note 1 1 S_Rec_1 2 1 S_Rec_2 3 1 S_Rec_3 4 2 S_Rec_4 5 4 S_Rec_5 6 4 S_Rec_6
¨â¸ê®Æªí¥H MasterID ÃöÁp MasterNo ¡A¬°¤@¹ï¦hÃöÁp
INNER JOIN ªº§e²{(©w¦¨Âù¦¨¹ï)
M_Rec_1,S_Rec_1
M_Rec_1,S_Rec_2
M_Rec_1,S_Rec_3
M_Rec_2,S_Rec_4LEFT JOIN ªº§e²{(¥DÃöÁp¸ê®Æªí³æ¤è³\¥i)
M_Rec_1,S_Rec_1
M_Rec_1,S_Rec_2
M_Rec_1,S_Rec_3
M_Rec_2,S_Rec_4
M_Rec_3,NullRIGHT JOIN ªº§e²{(³QÃöÁp¸ê®Æªí³æ¤è³\¥i)
M_Rec_1,S_Rec_1
M_Rec_1,S_Rec_2
M_Rec_1,S_Rec_3
M_Rec_2,S_Rec_4
Null,S_Rec_5
Null,S_Rec_6
³Ì«áªº¼G¥o¡G
³oÁöµM¬O MDB ¸ê®Æ®w«Ü°ò¥»ªº·§©À¡A¦ý¦pªG§AµLªk¥R¤À´x´¤¥¦·|¹ï§A¸ê®Æ¿ý²£¥Í¦óºØ¼vÅTªº¸Ü¡A§A´NµLªk½ñ¤JÃöÁp¸ê®Æ®wªº°ó¶ø¡A¦Ó¥u¯à³æ±i¸ê®Æªí¦b¨ºª±¨Óª±¥h¡A¦Ü©ó¸ê®Æ³W¹º¡B¸ê®Æ¤ÀªR§ó¬O¤£¥i¯àªº¤F¡C©Î³\§A¦´Nª¾¹D³o¨Ç¤F¡A¨º§Ú®¥³ß§A¡A§Ú¥u¬O¬è¬ßµÛ¦³¨Ç¹³·í®É¦~»´ªº§Úªº Program ªì¾ÇªÌ ¡A¯à¦bŪ¤F³o½g¤å³¹«á¡AÁŵM¶}®Ô¡A¹Ä¹Dì¨Ó³o»ò¦^¨Æ¡A¬O§Ú̦ۤv·Qªº¤Ó½ÆÂø¤F¡C
¦pªG§A¦V¨Ó¦b VB ùØ¥´Âà¡A¤Ö±µÄ²¸ê®Æ®w¡A§A¤@©w«Ü¤£¯à²z¸Ñ Null ªº§@¥Î¡A¨Æ¹ê¤W°£«D§A¥Î Variant = Null ¥h«ü¬£ Null ȨìÅܼÆùØ¥h¡A§A´X¥G¨S¦³¾÷·|¬Ý¨ì Null Ȫº¦Û°Ê²£¥Í¡AIsNull ³o¨ç¼Æ´N¦n¹³¼oª«¤@¯ë¡C¦ý¸ê®ÆªºÄæ¦ì¸ê®ÆùØ¡A«h·|¤j¶q²£¥Í Null ¡A¤@¯ë¤å¦r¡B¤é´Á...... µ¥Äæ¦ì¡AY§A¤£µ¹ªìÈ¡A¦b¸ê®Æ¿é¤J®É¤S¨S¦Vùر¿é¤J¸ê®Æ¡A¨º³o¨ÇÄæ¦ìȳ£¬O Null ¡ANull «¬ºA¦³Ó«Ü°Q¹½ªº¯S©Ê´N¬O¥ô¦óÈ»P¨ä°µ¥|«h¹Bºâ®É¡A¥un¨ä¤¤¦³¤@Ó¬O Null ¡A«h³Ì«áµ²ªG³£¬O Null ¡A¨º»ò Null*10 =Null §ÚÌÁÙ¥i¥H±µ¨ü¡AY Null +10=Null ¡A¨º¥i´N®¼·Ð¤Hªº¤F¡A¦]¬°¨º·|¨Ï¹Bºâ«áªºÅã¥Üµ²ªG¥X¥G§ÚÌ·N®Æ¤§¥~¡C
³oºØ¥Ñ¸ê®Æ®wÄæ¦ì²£¥Xªº©T©w Null ÈÁÙ¤£ºâ¤ÓÃø¸Ñ¨M¡A¦]¬°¼ÆÈ«¬ºAªºÄæ¦ìªìȳ£¬O 0 ¡A¦Ó¤£¬O Null¡A©Ò¥H¤ñ¸û¤£·|¦³ Null+10=Null ªº±¡ªp¡A¦Ü©ó¤å¦r«¬ºAÄæ¦ì¡A§Ú̥ΠNull & "ABCD" ¦Ó«D Null + "ABCD" ¤]¯àÁ׶}¦¹§xÂZ¡A¦Ü©ó Date «¬ºA¡Aµ¹Ó¹w³]È=Now ¤]´N¸Ñ¨M¤F¡C¦ý¦pªG§A»{¬°³o¼Ë´NÂ\²æ¤F Null Ȫº§xÂZ¡A¨º¥i´N¤j¿ù¯S¿ù¤F¡C
ÁÙ°O±o§Ú¦b [¤@¹ï¦h»P¥ª¥k³s±µ] ¨º½g½d¨Ò¤¤½Í¨ì¥ª¥k³s±µ®Éªº¸ê®Æ§e²{´¿³o¼Ë¥´¥X¸ê®Æ
M_Rec_1,S_Rec_3
M_Rec_2,S_Rec_4
Null,S_Rec_5
Null,S_Rec_6
Áo©ú¦p§A¬O§_¤wÁp·Q¨ì¡AÃø¹D¸óªí¬d¸ß·|²£¥Í Null È¡H¤@ÂI³£¨S¿ù¡A¦pªG§A¥Î INNER JOIN¡A¨º¸ê®Æ¿ý¬O¦¨Âù¥X²{ªº¡A°£«D§Aì¨ÓÄæ¦ì¬O Null¡A§_«h¤£¥i¯à²£¥Í Null¡C¦ý¦pªG¥Îªº¬O LEFT JOIN ©Î RIGHT JOIN ¡A¨º¯Ê®uªº¤@Ãä´N¬O Null È¡A¨º©È§Aì¨Ó©Ò¦³Äæ¦ì³£¤£¬O Null ¡A¤@¼Ë·|²£¥Í Null È¡A§óÁVªº¬O´Nºâ³oÓÄæ¦ì¬O¼ÆÈ«¬ºA¡A¬d¸ß©Ò±oµ²ªG¤@¼Ë¬O Null¡C¦Ó¦pªG§An¹ï¥¦°µ¹Bºâ¡Aµ²ªG·íµM³£¬O Null¡A¤£ºÞ§A¦b¸ê®ÆªíÄæ¦ì³]p®É«ç¼Ë¤p¤ß¡A³£µLªkÁקK¡C
©Ò¥H¦pªG§A¨Ï¥Î¤F RIGHT or LEFT ¡A¨º¦b¹ï¬d¸ßµ²ªG°µ¹Bºâ«e¡A½Ð¥ý¨Ï¥Î IsNull ¨ç¼Æ°µ§PÂ_¡A¦Ó¹ï Null »P«D Null °µ¤£¦Pªº³B²z¡C§A¥Ã»·µLªk¹w´Á¨Ï¥ÎªÌ¦b«Ø¥ß¥¦¦Û¤v¸ê®Æ®w®É·|¤£·|¦³¯Ê®u±¡ªp¡A©Ò¥H§A¥u¦³¹w´Á¥L·|¦³³o±¡ªp¡A¦Ó¨Æ¥ý¥[¥H¨¾½d¡C
¤j¬ü¤ksally ¼¶¼g©ó¤å³¹
item = .dbf ªº¸ê®Æ®w ,¸ê®ÆÀx¦s¤è¦¡¬°
=> orderno catologNO quantity ...
======= ======== ======
ex: A0001 aaa 1
A0001 bbb 5
A0001 ccc 4
§Æ±æ±o¨ìªºµ²ªG¬O
orderno = 'A0001' ªºÁ`¼Æ¶q
¦Ñ©Çµª¡G
SELECT orderno, Sum(quantity) AS Á`p
FROM item
GROUP BY orderno
HAVING orderno="A0001";
¥¿¦b¥¢·~¤¤...(man) ¼¶¼g©ó¤å³¹
¦bdatabase·s¼W¤@µ§¸ê®Æ¦ýq³æ§Ç¸¹©Î¬O¾P³f³æ§Ç¸¹¬O©T©w¦Û°Ê²£¥Íªº
¦Ñ©Çµª¡G
Option
Explicit
Dim Db As Database
Dim Rs As Recordset
'¦Û°Ê¼W¸¹ÅܼÆ
Dim AddNo As Long
Private Sub Command1_Click()
Dim FLength As Integer
'¨ú±o¦Û°Ê½s¸¹Äæ¦ìªø«×
FLength = Rs!SerialID.Size
'¦Û°Ê½s¸¹¥[¤@
AddNo = AddNo + 1
'·s¼W¤@µ§
Rs.AddNew
Rs!Note = Text1.Text
'AddNo Âন¦r¦ê¡A«e±¸É "0"
Rs!SerialID = Right(String(FLength,
"0") & _
Trim(CStr(AddNo)), FLength)
'¸ê®Æ§ó·s
Rs.Update
End Sub
Private Sub Form_Load()
Set Db = OpenDatabase("c:\user\mytest.mdb")
Set Rs = Db.OpenRecordset("autonum",
dbOpenDynaset)
'Rs.EOF And Rs.BOF=True ªí¥Ü autonum
Table ùØ©|¥¼¥[¤J¸ê®Æ
If Not (Rs.EOF And Rs.BOF) Then
'¨ú±o³Ì«á¤@µ§°O¿ýªº½s¸¹
Rs.MoveLast
'°²³]
SerialID Äæ¦ì¬O¦Û°Ê½s¸¹¸¹Äæ¡A
'Äæ¦ì«¬ºA
Text
AddNo = Rs!SerialID
End If
'²¾¨ì²Ä¤@µ§¥H§QÅã¥Ü
Rs.MoveFirst
End Sub
Private Sub Form_Unload(Cancel As Integer)
Rs.Close
Db.Close
End Sub
³Ìªñ±`¦³¤H°Ý§Ú¥H«e Dbase ªº DBF Àɳ£¦³ RecNo °O¿ý½s¸¹¥i¥H°t¦X°O¿ý«ü¼Ð²¾°Ê¡A¬°¦ó Dao ª«¥óùؤ£´£¨Ñ«¨¡H¨ä¹ê¦b Recordset ª«¥ó©³¤U¡AÁÙ¬O¦³ÓÃþ¦ü RecNo ÄÝ©Ê¥i¥H¥Îªº¡A¥s AbsolutePosition ¡A¤£¹L¥Î³oÄݩʦ³¤U¦C¨î¡G
ªG¥Ä ¼¶¼g©ó¤å³¹
¦p¦ó¼¶¼g¤@¬qµ{¦¡, §â¸ê®Æ®wÀ£ÁY??¦]¬°§Úµ{¦¡¥u¥Î¨ì¤@Ó¸ê®Æ®w,§Q¥Îcompactdatabase³oÓ¥\¯à, À£ÁYªº·sÂÂÀɦW¤£¯à¬Û¦P,§Úı±o«Ü©_©Ç, ·sÂÂÀɦW¤£¯à¬Û¦P?? ¨º§Ú·F¹Àn³o»ò¶O¤ßªº§â¥¦À£ÁY,
¦Ñ©Çµª¡G
DBEngine.CompactDatabase oldmdb, newmdb
FileCopy newmdb,oldmdb
Kill newmdb
(°õ¦æ¦¹µ{¦¡»Ý¥ý Close ¸ê®Æ®w)
jw86 ¼¶¼g©ó¤å³¹
½Ð°Ý¤£¥ÎDATA¤¸¥ó,¦p¦óOPEN¤@ÓXLSÀÉ?set db=OpenDatabase("¸ê®Æ®w")¥u¯à¶}mdb,*.xlsÀÉn¦p¦ó¶}±Ò©O?
¦Ñ©Çµª¡G
Option Explicit
Dim Db As Database
Dim Rs As Recordset
Private Sub Form_Load()
Set Db = OpenDatabase("c:\temp\book1.xls", False, False, "Excel 8.0;")
Set Rs = Db.OpenRecordset("sheet1$")
'(SheetName «á±¤@©w°O±on¥[ "$" ²Å¸¹)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Rs.Close
Db.Close
End Sub
³o¬O³Ì²³æªº¿ìªk¡A¸Ô²Óªº¨Ï¥Î¤èªk¤Î¨î½Ð°Ñ¬Ý VB OnLineHelp ¡A¸ê®Æ¦s¨úª«¥ó¤â¥U¡B¨ú±o¥~³¡¸ê®Æ¡B¨Ï¥Î¸Õºâªí¤@³¹¡C