① VB創建多個sql表
SQL語句如下:
可以同時創建兩個表
CREATETABLE[dbo].[tb_b_Language]([LanguageID][tinyint]NOTNULL,[LanguageName][varchar](20)NOTNULL)ON[PRIMARY];CREATETABLE[dbo].[tb_b_Menu]([MenuID][smallint]NOTNULL,[MenuName][varchar](50)NOTNULL,[MenuType][tinyint]NOTNULL,[ParentMenuID][smallint]NULL,[OrderNum][smallint]NOTNULL,[IsDisplay][tinyint]NOTNULL)ON[PRIMARY]
② vb 用SQL創建ACCESS多表語句
Dim
DefDatabase
As
Database
Dim
PathName
As
String
Dim
conn
Dim
sql
As
String
PathName
=
App.Path
Set
DefDatabase
=
CreateDatabase(PathName
+
"\db.mdb",
dbLangGeneral)
DefDatabase.Close
Set
conn
=
CreateObject("ADODB.Connection")
conn.Open
"provider=microsoft.jet.oledb.4.0;data
source="
&
PathName
+
"\db.mdb"
sql
=
"create
table
MyTable
(
編號
autoincrement(1,1)
,
姓名
varchar(50)
,
constraint
pk_test_id
primary
key(編號))"
conn.Execute
sql
'-------重復以下這里就可以了
sql
=
"create
table
MyTable2
(
編號
autoincrement(1,1)
,
姓名
varchar(50)
,
constraint
pk_test_id
primary
key(編號))"
conn.Execute
sql
'-------重復以上代碼
MsgBox
"創表成功"
③ vb 中使用sql語句創建表結構
SQL語法的問題