c# - transaction locks in MySqlHelper class -


I am going to call mysql db in my .net code and for this i mysql.data.dll . In my scenario I used the MySqlHelper class but in this scenario there are two inputs and I want to record commit if only if both are correctly inserted otherwise I rollback want

  internal boolean addcutomer (customer c) {string sqlCustomerQuery = "tab controller value (" + + c.barcode + ", '" + c .custxml + "''); Int results = MySqlHelper.ExecuteNonQuery (connectionString, sqlCustomerQuery); if (result> 0) {string sqlProjCustomer =" tab_pr Insert in oject_customersVALUES ('"+ c.barcode +' ','" + c.ProjectID + "')"; MySqlHelper.ExecuteNonQuery (connectionString, sqlProjCustomer); Back true; } And false return; }  

My question:

  1. How can I return to this scenario?
  2. I found that can be used to do this & amp; Rollback How can I use it if I am going to use it? Or what is another way to do this?
  3. We can create class and traditional method (connections, commands, etc.) and MySqlHelper class method?
  4. Does assistant handle the locks automatically?

    You can use the ### transaction.



Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -