当我在下面运行代码时,我得到如下结果,它没有分号,并且在richtextbox 上的每一行都有一个换行符。最后一行有两个分号....有没有办法让每一行以分号结尾,然后在richtextbox上的一个行空间?
using (OracleCommand crtCommand = new OracleCommand(myCommand, conn1))
{
using (OracleDataReader reader = crtCommand.ExecuteReader())
{
while (reader.Read())
{
if (!reader.IsDBNull(0))
{
richTextBox1.AppendText(Environment.NewLine);
richTextBox1.AppendText(reader[0].ToString().TrimEnd('\r', '\n', ' ') + ";");
richTextBox1.AppendText(Environment.NewLine);
}
}
}
}
结果:
ALTER TABLE "TBL_A" ADD ("FIELD_A3" DATE)
ALTER TABLE "TBL_A" DROP ("FIELD_A6")
ALTER TABLE "TBL_A" MODIFY ("FIELD_A2" VARCHAR2(50))
ALTER TABLE "TBL_A" MODIFY ("FIELD_A4" NUMBER(5,2) DEFAULT 0)
ALTER TABLE "TBL_A" MODIFY ("FIELD_A4" NULL)
ALTER TABLE "TBL_A" MODIFY ("FIELD_A5" NOT NULL ENABLE);
;
预期结果:
ALTER TABLE "TBL_A" ADD ("FIELD_A3" DATE);
ALTER TABLE "TBL_A" DROP ("FIELD_A6");
ALTER TABLE "TBL_A" MODIFY ("FIELD_A2" VARCHAR2(50));
ALTER TABLE "TBL_A" MODIFY ("FIELD_A4" NUMBER(5,2) DEFAULT 0);
ALTER TABLE "TBL_A" MODIFY ("FIELD_A4" NULL);
ALTER TABLE "TBL_A" MODIFY ("FIELD_A5" NOT NULL ENABLE);