
上QQ阅读APP看书,第一时间看更新
The DeleteCustomer method
The DeleteCustomer method deletes the customer that's passed by executing the DELETE statement:
// Delete Customer method with parameter customer
func DeleteCustomer(customer Customer) {
var database *sql.DB
database= GetConnection()
var error error
var delete *sql.Stmt
delete,error = database.Prepare("DELETE FROM Customer WHERE Customerid=?")
if error != nil {
panic(error.Error())
}
delete.Exec(customer.CustomerId)
defer database.Close()
}
Let's take a look at the CRM web application in the next section.