public UserDataSet.ArrowDataTable GetData(string query, Dictionary <string, object> paras) { UserDataSet.ArrowDataTable dt = new UserDataSet.ArrowDataTable(); SQLiteCommand cmd = new SQLiteCommand(query, this.Connection); foreach (var item in paras) { cmd.Parameters.Add( new SQLiteParameter(item.Key, item.Value) ); } Adapter.SelectCommand = cmd; Adapter.Fill(dt); return(dt); }
private void LaunchArrows(Dictionary <string, string> msg) { #if _debug DateTime time = DateTime.Now; #endif UserDataSetTableAdapters.ArrowTableAdapter ad = new UserDataSetTableAdapters.ArrowTableAdapter(); UserDataSet.ArrowDataTable dt = ad.GetData( "select * from [Arrow] where [Name] = @Name or [Name] like @Names", new Dictionary <string, object> { { "@Name", msg["Name"] }, { "@Names", msg["Name"] + ".%" } } ); // this method is slower than above //var dt = ad.GetData(); //var row = (from r in dt // where r.Name == msg[dt.NameColumn.ColumnName] // select r).First(); if (dt.Count == 1) { LaunchArrow(dt[0], msg["Arg"]); } else { foreach (var row in dt) { LaunchArrow(row); } } ad.Update(dt); #if _debug Console.WriteLine(msg["Name"]); Console.WriteLine(msg["Arg"]); Console.WriteLine("time: " + DateTime.Now.Subtract(time).TotalMilliseconds + "\r\n"); #endif }
public UserDataSet.ArrowDataTable GetData(string query, Dictionary<string, object> paras) { UserDataSet.ArrowDataTable dt = new UserDataSet.ArrowDataTable(); SQLiteCommand cmd = new SQLiteCommand(query, this.Connection); foreach (var item in paras) { cmd.Parameters.Add( new SQLiteParameter(item.Key, item.Value) ); } Adapter.SelectCommand = cmd; Adapter.Fill(dt); return dt; }