请教大神。我想通过SQL语句删除DataGrid中选中的某一行,下面的这段代码怎么删不掉呢?
程序代码:
Private Sub cmdDelete_Click() '打开错误处理陷阱 Dim intErrFileNo As Integer '自由文件号 On Error GoTo ErrGoto '---------------------------------------------------- '打开数据库连接 OpenDBFile 'DataGrid1.Col = 0 'DataGrid1.Row = CurEm If vbYes = MsgBox("是否删除" & DataGrid1.Text & "?", vbYesNo) Then '执行删除 DataGrid1.Row = CurEm DataGrid1.Col = 0 gCon.Execute "DELETE FROM 设备型号 WHERE 序号 = """ & DataGrid1.Text & """ " End If '关闭数据库连接 CloseDBFile '刷新数据 Adodc1.Refresh '---------------------------------------------------- Exit Sub '----------------------------- ErrGoto: '把错误信息保存在文件里 intErrFileNo = FreeFile() Open "YFSystem.ini" For Append As intErrFileNo Print #intErrFileNo, Chr(34) + Format(Now, "YYYY-MM-DD HH:MM:SS") + Chr(34), Chr(34) + "信息" + Chr(34), Chr(34) + Err.Description + Chr(34), Chr(34) + "cmdDelete_Click(bianji)" + Chr(34), Chr(34) + App.Title + Chr(34) Close #intErrFileNo End Sub