Using SQL in a Blank Application

The examples provided in videos and here on the forum are not very informative on this subject. I am using a MySQL database and I would like to use the Blank Application to run my code. Below is a sample statement that I want to run and I am not sure how to convert it to work properly within the Blank Application.


UPDATE tbl_orders 
SET LoadRevenue = CASE
  WHEN LoadRevenue IS NOT NULL THEN LoadRevenue
  WHEN RateMiles = -1 THEN 65
  WHEN LoadRevenue IS NULL AND NetBarrels >= 210.00 THEN LoadRate * RateMiles
  WHEN LoadRevenue IS NULL AND NetBarrels < 210.00 THEN LoadRate * 210.00
END;

Just to be clear, I know the code works on my database but when I put this into a Blank Application it does not work. So I need to know how to make this code compatible with ScriptCase. Thank you in advance for your help!

Re: Using SQL in a Blank Application

Since no one answered and I figured it out, here is how the code can be made to work within ScriptCase:


mysql_query("
UPDATE tbl_orders 
SET LoadRevenue = CASE
  WHEN LoadRevenue IS NOT NULL THEN LoadRevenue
  WHEN RateMiles = -1 THEN 65
  WHEN LoadRevenue IS NULL AND NetBarrels >= 210.00 THEN LoadRate * RateMiles
  WHEN LoadRevenue IS NULL AND NetBarrels < 210.00 THEN LoadRate * 210.00
  END;
");

Hopefully that will answer the question if anyone else has the same issue.