### DBUtils Delete a Record

The DBUtils class (only compatible with SQLite databases, status 20170228), as provided by B4J, has various Subs defined.
To delete a record from a SQL database, the Sub DeleteRecord is provided:
`Sub DeleteRecord(SQL As SQL, TableName As String, WhereFieldEquals As Map)
Dim sb As StringBuilder
sb.Initialize
sb.Append("DELETE FROM [").Append(TableName).Append("] WHERE ")
If WhereFieldEquals.Size = 0 Then
Log("WhereFieldEquals map empty!")
Return
End If
Dim args As List
args.Initialize
For i = 0 To WhereFieldEquals.Size - 1
If i > 0 Then sb.Append(" AND ")
sb.Append("[").Append(WhereFieldEquals.GetKeyAt(i)).Append("] = ?")
args.Add(WhereFieldEquals.GetValueAt(i))
Next
Log("DeleteRecord: " & sb.ToString)
SQL.ExecNonQuery2(sb.ToString, args)
End Sub`
Example usage Delete all Records where Test = 'Test #3'
Dim m As Map
m.Initialize
m.Put("Test", "Test #3")
DBUtils.DeleteRecord(SQL, "Grades", m)

Changed: , Category: Database, File: T6C181M1306.htm, ID: 1306