|
@{
try
{
var name = Request["Ship Name"];
var country = Request["Ship Country"];
var oDate = Request["Order Date"];
var shipped = (Request["Shipped"] == "true" ? true : false);
var db = Database.Open("Orders");
db.Execute(@"INSERT INTO Orders ([Ship Name], [Ship Country], [Order Date],
[Shipped])
VALUES (@0, @1, @2, @3)", name, country, oDate, shipped);
var order = db.QuerySingle("SELECT * FROM Orders WHERE [Order Id] = @0",
db.GetLastInsertId());
var json = Json.Encode(new{Result = "OK", Record = order});
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.