/// <summary> /// 多线程使用案例 /// </summary> public static void TestTask() { List <Task> tasks = new List <Task>(); HashObjectList datasourcecombase = new HashObjectList(); var listtask = Task.Run(() => { //1.查询列表 UnitsClass.IsSetTimeout(); datasourcecombase = new DALBase("erp", DBrwType.Write, true).GetDataList(HashObject.CreateWith("profileid", 10004621), "select * from bas_account where profileid=10004621;", SqlType.CmdText); }); tasks.Add(listtask); try { Task.WaitAll(tasks.ToArray()); } catch (Exception e) { throw; } Console.WriteLine(datasourcecombase.Count()); }
/// <summary> /// 查询数据案例 /// </summary> public static void ViewData() { HashObjectList datasourcecombase = new DALBase("erp").GetDataList(HashObject.CreateWith("profileid", 10004621), "select * from bas_account where profileid=10004621;", SqlType.CmdText); Console.WriteLine(datasourcecombase.Count()); }
public static void ViewData() { string sqlwhere = string.Format(@"update bas_account set ModifyTime=now() where aid=1;"); //HashObjectList datasourcecombase = // new DALBase("erp").GetDataList(HashObject.CreateWith("profileid", 10004621), "select * from bas_account where profileid=10004621;", SqlType.CmdText); //Console.WriteLine(datasourcecombase.Count()); new DALBase("erp").ExecuteNonQuery(HashObject.CreateWith("profileid", 10004621), sqlwhere, SqlType.CmdText); }