using (OracleCommand crtCommand = new OracleCommand("myCommand", conn1))
{
richTextBox1.AppendText(Environment.NewLine);
richTextBox1.AppendText(crtCommand.ExecuteScalar().ToString() + ";");
richTextBox1.AppendText(Environment.NewLine);
}
结果:
CREATE UNIQUE INDEX "XPKTBL_A" ON "TBL_A" ("FIELD_A1")
;
预期结果:
CREATE UNIQUE INDEX "XPKTBL_A" ON "TBL_A" ("FIELD_A1");
答案 0 :(得分:0)
尝试以下
string g = crtCommand.ExecuteScalar().ToString() + ";";
richTextBox1.AppendText(g.Replace("\n", string.Empty));
而不是
richTextBox1.AppendText(crtCommand.ExecuteScalar().ToString() + ";");
答案 1 :(得分:0)
@AndreasNiedermair已在评论中提出,但修剪换行应该有帮助
richTextBox1.AppendText(crtCommand.ExecuteScalar().ToString().TrimEnd('\r', '\n', ' ') + ";");
答案 2 :(得分:0)
正如我在评论中已提到的那样,只需将其添加为答案。
richTextBox1.AppendText(String.Format("{0};",crtCommand.ExecuteScalar().ToString()));