private void button1_Click(object sender, EventArgs e) { string txt = this.richTextBox1.Text; txt = txt.Replace("\n", ","). Replace(" ", "!"). Replace(" ", "!"). Replace(" ", "!"). Replace(" ", "!"). Replace(" ", "!"). Replace(" ", "!"). Replace(" ", "!"). Replace(" ", "!"). Replace(",", "],MAX(CASE WHEN s.Col_name_en ='"). Replace("!", "' THEN s.Actual ELSE null END) as "). Replace("as", "as [").Replace("[ ", "[").Replace(" [_","_").Replace("_as [' ", "_as' "); this.richTextBox2.Text = "MAX(CASE WHEN s.Col_name_en ='" + txt; }
2019-3-28 更新 截取字符。
//////基于getsql方法 封装的获取列方法。 /// /// ///private string GetColByMessage(string MessageSql) { string[] a = MessageSql.Split(','); string relstr = ""; foreach (var item in a) { relstr += item.Substring(item.IndexOf("as ") + 2).Trim() + ","; } return relstr.Substring(0, relstr.Length - 1); }