读书人

跪求啊为什么删不掉解决办法

发布时间: 2012-02-23 22:01:35 作者: rapoo

跪求啊~~~~~~~~~为什么删不掉
Private Sub DeleteTextCompany()
Call GetCompany
Dim gjstring As String
Dim c As Long
Dim rs1 As ADODB.Recordset
If TextCompany(0).Text = "" Then
MsgBox ("请选中删除内容!")
Else
gjstring = TextCompany(0)
gjstring = "select * from ÆóÒµÐÅÏ¢ where ÆóÒµÐÅÏ¢.ID=" & gjstring
rs1.CursorLocation = adUseClient
rs1.Open gjstring, m_Connection, adOpenDynamic, adLockOptimistic
If rs1.EOF = False Then
c = MsgBox("ÄúÈ·ÈÏҪɾ³ý¸Ã¼Ç¼Âð£¿", vbOKCancel, "ɾ³ýÌáʾÐÅÏ¢")
If c = vbOK Then
rs1.Delete gjstring, m_Connection, adOpenDynamic, adLockOptimistic
rs1.Update
End If
End If
End If
End Sub

[解决办法]
MSDN
Example

The following code shows how to delete a record using the Delete method.

Dim rs
Set rs = CreateObject("adoce.recordset")
rs.Open "myTable", "", 1, 3
rs.MoveLast
'This statement deletes the current (last) record.
rs.Delete
'This statement moves the pointer to the
'first record in the recordset which removes
'the deleted record from the recordset.
rs.MoveFirst
rs.Update
rs.Close
Set rs = Nothing

读书人网 >VB

热点推荐