久久―日本道色综合久久,亚洲欧美精品在线,狼狼色丁香久久婷婷综合五月,香蕉人人超,日本网站黄,国产在线观看不卡免费高清,无遮挡的毛片免费

2023信創(chuàng)獨(dú)角獸企業(yè)100強(qiáng)
全世界各行各業(yè)聯(lián)合起來,internet一定要實(shí)現(xiàn)!

用 VB 建立 Access 數(shù)據(jù)庫結(jié)構(gòu)

2004-02-12 eNet&Ciweek

  用VB建立Access數(shù)據(jù)庫結(jié)構(gòu)

  Private Sub Command1_Click()

  On Error GoTo Err100

  注釋:定義表與字段

  Dim DefDatabase As Database

  Dim DefTable As TableDef, DefField As Field

  Set DefDatabase = Workspaces(0).OpenDatabase(App.Path & "\vbeden.mdb", 0, False)

  Set DefTable = DefDatabase.CreateTableDef("VBs")

  注釋:dbBinary = 9

  注釋:dbBoolean = 1

  注釋:dbByte = 2

  注釋:dbChar=18

  注釋:dbDate=8

  注釋:dbInteger=3

  注釋:dbLong=4

  注釋:dbMemo=12

  注釋:dbText=10

  注釋:建立Name字段為8個(gè)字符型

  Set DefField = DefTable.CreateField("Name", dbText, 8)

  DefTable.Fields.Append DefField  

  Set DefField = DefTable.CreateField("Sex", dbText, 2)

  DefTable.Fields.Append DefField

    

  注釋:該字段允許為空

  DefField.AllowZeroLength = True

  注釋:建立Age字段為3個(gè)的常整型

  Set DefField = DefTable.CreateField("Age", dbInteger, 3)

  注釋:字段追加

  DefTable.Fields.Append DefField  

  注釋:表追加

  DefDatabase.TableDefs.Append DefTable  

  MsgBox " VB編程樂園數(shù)據(jù)庫建立完成!", vbInformation  

  Exit Sub  

  Err100:

  MsgBox "對不起,不能建立表。請先再建表前建立VBEden數(shù)據(jù)庫? ", vbCritical  

  End Sub  

  Private Sub cmdCreate_Click()  

  On Error GoTo Err100  

  注釋:建立名為 VBEDEN 的數(shù)據(jù)庫

  CreateDatabase "VB-CODE", dbLangGeneral  

  MsgBox "數(shù)據(jù)庫建立完成! ", vbInformation

  Exit Sub

  

  Err100:

  MsgBox "不能建立數(shù)據(jù)庫! " & vbCrLf & vbCrLf & Err.Description, vbInformation

  End Sub

相關(guān)頻道: eNews

您對本文或本站有任何意見,請?jiān)谙路教峤?,謝謝!

投稿信箱:tougao@enet16.com