問題:
如何用sql語句添加刪除主鍵
回答:
Function AddPrimaryKey()
'添加主鍵到[編號]字段
Dim strSQL As String
strSQL = "ALTER TABLE 表1 ADD CONSTRAINT PRIMARY_KEY " _
& "PRIMARY KEY (編號)"
CurrentProject.Connection.Execute strSQL
End Function
Function DropPrimaryKey()
'刪除主鍵
Dim strSQL As String
strSQL = "ALTER TABLE 表1 Drop CONSTRAINT PRIMARY_KEY "
CurrentProject.Connection.Execute strSQL
End Function
獲取鍵名請用 "如何得到一個(gè)表的所有鍵?以及鍵的類型?" 為關(guān)鍵字搜索access911文章
或直接查看以下鏈接http://access911.net/index.asp?board=4&mode=3&recordid=72FAB21E11DC
如何用sql語句添加刪除主鍵
回答:
Function AddPrimaryKey()
'添加主鍵到[編號]字段
Dim strSQL As String
strSQL = "ALTER TABLE 表1 ADD CONSTRAINT PRIMARY_KEY " _
& "PRIMARY KEY (編號)"
CurrentProject.Connection.Execute strSQL
End Function
Function DropPrimaryKey()
'刪除主鍵
Dim strSQL As String
strSQL = "ALTER TABLE 表1 Drop CONSTRAINT PRIMARY_KEY "
CurrentProject.Connection.Execute strSQL
End Function
獲取鍵名請用 "如何得到一個(gè)表的所有鍵?以及鍵的類型?" 為關(guān)鍵字搜索access911文章
或直接查看以下鏈接http://access911.net/index.asp?board=4&mode=3&recordid=72FAB21E11DC

