从表中删除一条记录
    怎吗实现不料我的代码是我好着急啊
Dim rsResult As ADODB.Recordset, cnconn As ADODB.Connection
   Dim strSQL As String
    Set rsResult = New ADODB.Recordset
    Set cnconn = New ADODB.Connection
    cnconn.Open sStrProvider
    strSQL = "Select BOM_CodeNO From Costume_BOMMemo Where BOM_CodeNO like '" & Trim(txtCodeNO.Text) & "'"
    rsResult.Open strSQL, cnconn, adOpenKeyset, adLockOptimistic
      If Button = 2 Then
         If MsgBox("确定要删除这条记录吗?", 36, "注意!") = 6 Then
           strSQL = " Delete from Costume_BOM where BOM_CodeNO='" & Trim(txtCodeNO.Text) & "' and BOM_Type='" & Trim(txtCodeNO.Text) & "'  and BOM_NO='" & Trim(txtCodeNO.Text) & "' "
           cnconn.Execute strSQL
           SGrid.Refresh
           
        End If
      End If

解决方案 »

  1.   

    If MsgBox("确定要删除这条记录吗?", 36, "注意!") = 6 Then
    改成:
    if msgbox("确定要删除这条记录码?",vbyesno+vbquestion,"提示")=vbyes then
    试试
      

  2.   

    Dim rsResult As ADODB.Recordset
       Dim cnconn As ADODB.Connection
       Dim strSQL As String
        Set rsResult = New ADODB.Recordset
        Set cnconn = New ADODB.Connection
        cnconn.Open "连接数据库"
        If Button = 2 Then
             If MsgBox("确定要删除这条记录吗?", 36, "注意!") = 6 Then
               strSQL.open" Delete from Costume_BOM where BOM_CodeNO='" & Trim(txtCodeNO.Text) & "' and BOM_Type='" & Trim(txtCodeNO.Text) & "'  and BOM_NO='" & Trim(txtCodeNO.Text) & "' ",cnconn, adOpenKeyset, adLockOptimistic
               cnconn.Execute strSQL
               SGrid.Refresh
               
            End If
          End If