private void cmdRun() { CloudData cd = new CloudData(URL, Key); cd.SetTimeout(Timeout); var rs = cd.Query(Query); Result = rs.RawContent; try { //Object jObject = JsonConvert.DeserializeObject<JObject>(Result); ResultDataTable = JsonConvert.DeserializeObject<DataTable>(Result); // = data.Tables[0]; StringBuilder sb = new StringBuilder(); foreach (var i in ResultDataTable.Columns.Cast<DataColumn>()) { sb.AppendLine($"public {i.DataType.ToString()} {i.ColumnName} " + "{get ; set ; }"); } ResultCode = sb.ToString(); } catch (Exception ex) { ResultDataTable = new DataTable(); } OnPropertyChanged("Result"); OnPropertyChanged("ResultCode"); OnPropertyChanged("ResultDataTable"); }
static void Main(string[] args) { CloudData cd = new CloudData("http://fhdist.com/fishbowl/", "2497!NjSDKJ"); cd.SetTimeout(10000); var rs = cd.Query("select * from oc_country"); Console.WriteLine(rs.StopWatch.Elapsed.ToString()); var obj = cd.Query<List<TestObject>>("select * from oc_country limit 10"); if(obj.Data != null) Console.WriteLine("Records: " + obj.Data.Count); var test = cd.Execute("update oc_country set address_format = 'TEST' where country_id = 1"); Console.WriteLine(test.Executed); Console.WriteLine(test.StopWatch.Elapsed.ToString()); Console.ReadLine(); }