|
@{
try
{
var order = Request["Order Id"];
var name = Request["Product Name"];
var price = Request["Unit Price"];
var quant = Request["Quantity"];
var db = Database.Open("Orders");
db.Execute(@"INSERT INTO Details ([Order Id], [Product Name], [Unit Price], [Quantity])
VALUES (@0, @1, @2, @3)", order, name, price, quant);
var detail = db.QuerySingle("SELECT * FROM Details WHERE [Detail Id] = @0",
db.GetLastInsertId());
var json = Json.Encode(new{Result = "OK", Record = detail});
Response.Write(json);
}
catch (Exception ex)
{
var json = Json.Encode(new{Result = "ERROR", Message = ex.Message});
Response.Write(json);
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.