-4
我想顯示的消息「真」當我的DataGridView檢查複選框,但它始終顯示「假」即時尋找解決方案,這是我的代碼複選框總是返回False vb.net
Try
'opening the connection
con.Open()
If row.Cells(15).FormattedValue = False Then
'store your delete query to a variable(sql)
sql = "DELETE FROM terres WHERE id = '" _
& CStr(row.Cells(3).FormattedValue) & "'"
MsgBox(row.Cells(3).FormattedValue)
'Set your MySQL COMMANDS
With cmd
.Connection = con
.CommandText = sql
End With
'Execute the Data
result = cmd.ExecuteNonQuery
End If
Next
'the condition is, if the result is equals to zero
'then the message will appear and says "No Deleted Record."
'and if not the message will appear and says "The Record(s) has been deleted.."
If result = 0 Then
MsgBox("No Deleted Record.")
Else
MsgBox("The Record(s) has been deleted.")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
'Close the connection
con.Close()
這看起來不像C#。你爲什麼要這樣標記?你的代碼中的複選框在哪裏?它的價值在哪裏?在調試器中看到的值是什麼* –
您可以發佈datagridview的標記嗎? –
我怎麼能做到即時通訊使用vb 2008 @Rickjames –