.Refresh End With ) do until Adodc1.Recordset.eof If Adodc1.Recordset.Fields(Name).Value = Trim(Me.txtr3.Text) Then Adodc1.Recordset.Delete Adodc1.Recordset.Update exit do endif Adodc1.Recordset.MoveNext loop
我不喜欢上面方式,我喜欢用SQL 语句。例:"delete from CUM Where name ='" & txtr3.Text & "'"
Dim dbfix As String
Dim DBsource As String
Dim DBtype As String
' On Error GoTo ERRprocess
dbfix = "Provider=SQLOLEDB.1;Persist Security Info=True;Initial Catalog=B1_R3;Data Source=" & DB_Address
With Me.Adodc1
.CommandTimeout = 30
.ConnectionString = dbfix
.CommandType = adCmdText
.RecordSource = "select * from CUM" .UserName = DB_User
.password = DB_Password
.Refresh
End With
)
If Adodc1.Recordset.Fields(Name).Value = Trim(Me.txtr3.Text) Then
Adodc1.Recordset.Delete
Adodc1.Recordset.Update
end if
Exit Function
End Function
Dim dbfix As String
Dim DBsource As String
Dim DBtype As String
' On Error GoTo ERRprocess
dbfix = "Provider=SQLOLEDB.1;Persist Security Info=True;Initial Catalog=B1_R3;Data Source=" & DB_Address
With Me.Adodc1
.CommandTimeout = 30
.ConnectionString = dbfix
.CommandType = adCmdText
.RecordSource = "select * from CUM" .UserName = DB_User
.password = DB_Password
.Refresh
End With
)
do until Adodc1.Recordset.eof
If Adodc1.Recordset.Fields(Name).Value = Trim(Me.txtr3.Text) Then
Adodc1.Recordset.Delete
Adodc1.Recordset.Update
exit do
endif
Adodc1.Recordset.MoveNext
loop