插入到 MS Access 2010 中的两个表中

INSERT into two tables in MS Access 2010

我有两个 table,分别是 STAFFLOGIN

员工

staffId    - Number
staffName  - Text
staffEmail - Text

登录

staffName  - Text
staffPwd   - Text

我的问题是,如何执行查询以将 "Name" 插入 STAFF.staffNameLOGIN.staffName

由于我是新手,有人可以帮助我吗?有什么建议么?我可以使用内部连接吗?如果可以,怎么做?

注意:我使用的是 VB.NET 和 Access 2010。因此文本框 staffName.Text 中的数据应插入两个 table (LOGIN & STAFF)

所以它会是这样的:

Dim mysql As String = "INSERT INTO STAFF VALUES ('" & txt_id.Text & "', '" & txt_name.Text & "', '" & txt_username.Text & "', '" & txt_username.Text & "', '" & txt_email.Text & "')"

但这是针对 table STAFF 的,无需插入 LOGIN

如果您想将 insert 数据分成两个 table,那么您需要两个单独的 insert 语句。

对于STAFFtable

INSERT INTO STAFF(staffId,staffName,staffEmail) VALUES (..

对于LOGINtable

INSERT INTO LOGIN(staffName,staffPwd) VALUES (..

作为旁注,您应该在 LOGIN table 中引用 staffId 而不是 staffName。两个 staff's 可以同名