工做日記--將接口表直接變成查詢的代碼

 

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 更新 截取字符。sql

/// <summary>
        ///基於getsql方法 封裝的獲取列方法。 /// </summary>
        /// <param name="MessageSql"></param>
        /// <returns></returns>
        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); }
相關文章
相關標籤/搜索