刚才的代码贴错了
private Sub Command1_Click()
Adodc1.Recordset.AddNew
With Adodc1
.Recordset("驾驶员代码") = Trim(Text1.Text)
.Recordset("姓名") = "1"
.Recordset("是否离职") = "1" .Recordset.Update
End With
End Sub
private Sub Command1_Click()
Adodc1.Recordset.AddNew
With Adodc1
.Recordset("驾驶员代码") = Trim(Text1.Text)
.Recordset("姓名") = "1"
.Recordset("是否离职") = "1" .Recordset.Update
End With
End Sub
Dim cnn1 As ADODB.Connection
Dim rstEmployees As ADODB.Recordset
rstEmployees.AddNew
rstEmployees!驾驶员代码= Trim(Text1.Text)
rstEmployees!姓名 = "1"
rstEmployees!是否离职 = "1"
rstEmployees.Update
Private Sub Command1_Click()
Dim Rst1 As New ADODB.Recordset
Rst1.Open "select * from 你要打开的表名", 联接字符串, adOpenDynamic, adLockBatchOptimistic
Rst1.AddNew
With Rst1
!驾驶员代码=Trim(Text1.Text)
!姓名="1"
!是否离职="1" .Update
End With
Rst1.Close
End Sub
Adodc1.Recordset.AddNew
官方正式写法:
With Adodc1
.Recordset.fields("驾驶员代码").value = Trim(Text1.Text)
.Recordset.fields("姓名").value = "1"
.Recordset.fields("是否离职").value = "1" .Recordset.Update
End With
End Sub