creat table table_name field1 field1_type ;
解决方案 »
- 手机发帖试试
- 发送e_mail的问题
- 语句太长了,要分成几行写,但是忘记了用哪个特殊的符号才能分行.在线等待,马上给分!
- 如何用SELECT将SQL数据库内容转成TXT文件
- vb里面碰到“&”开头,“;”结尾的字符串,怎么转换到相应的字符?
- 谁告诉我怎么获取系统时间啊!
- 如何获取输入焦点所在控件(在另一应用程序上)的句柄?(在线等待)
- 文本框中加入什么字符可以实现换行呀?
- 请各位帮忙,我还是新手!
- 那位高手告诉我:怎样用程序实现modem 连接
- 请问哪里有 Wise Install Master 8.14 下载
- winsock:一:A是服务端,B是客户端,怎么相互判断是否打开了WINSOCK?二:请看下面:
到MSDN里搜索createdatabase。
Dim db As Database 'New database
Dim tb As Recordset 'New database's record
Dim tbdef As TableDef 'The define of the new database's table
Dim dbField As Field 'The field of the new database
Dim Idx As Index 'The index of the new database
Dim Field_Type As Long 'The type of the new database's field
Dim lngFlag As Long ' field Flag
Dim lngstart As Long 'test time start
Dim lngend As Long 'test time end
On Error Resume Next
lngstart = GetTickCount()
StrMDBName = gStrFileWorkPath & "\" & gnewMdb_Attribute.strMdb_File_Name 'get the new mdb's name
If Dir$(StrMDBName) <> "" Then
Kill StrMDBName 'If StrMDBName Existes then delete strMDBName
Set db = Workspaces(0).CreateDatabase(StrMDBName, dbLangJapanese, dbVersion30)
Else
Set db = Workspaces(0).CreateDatabase(StrMDBName, dbLangJapanese, dbVersion30)
End If
Set tbdef = db.CreateTableDef(gnewMdb_Attribute.strMdb_Table_Name) 'Build table '//Build field
If bFlag Then
Set dbField = tbdef.CreateField("_MFLAG", dbText, 1)
dbField.AllowZeroLength = True
tbdef.Fields.Append dbField
End If
For lngFlag = 1 To Val(gnewMdb_Attribute.strMdb_Field_Count)
Select Case gnewField_Attribute(lngFlag).strMdb_Field_type
Case "Text":
Field_Type = dbText
Case "AutoNo"
Field_Type = dbText
Case "Date"
Field_Type = dbDate
Case "Long"
Field_Type = dbLong
Case "Byte"
Field_Type = dbByte
Case Else
Field_Type = -1
End Select
Set dbField = tbdef.CreateField(gnewField_Attribute(lngFlag).strMdb_Field_Name, Field_Type, _
Val(gnewField_Attribute(lngFlag).strMdb_Field_Size)) If Field_Type = dbText Then
dbField.AllowZeroLength = True 'If true then Allow Field Null else not allow null
ElseIf Field_Type = dbLong Or _
Field_Type = dbByte Then
dbField.DefaultValue = 0 'If Type is byte the default's value is 0
End If
dbField.Required = False 'If true then the field's value must not be null
tbdef.Fields.Append dbField
Next lngFlag
If bFlag Then
For lngFlag = 1 To Val(gnewMdb_Attribute.strMdb_Field_Count)
Set dbField = tbdef.CreateField("_" & gnewField_Attribute(lngFlag).strMdb_Field_Name, dbText, 1)
dbField.AllowZeroLength = True
tbdef.Fields.Append dbField
Next lngFlag
End If
db.TableDefs.Append tbdef
db.Close
Set tbdef = Nothing
Set db = Nothing