string strTeachingPlan = this.txtTeachingPlan.Text.ToString().Trim();
string[] maarr = strTeachingPlan.Split('
'); //文本中隐含的回车换行符给去掉 每行末尾加上换行符"
" 保存到数据库
string strText = string.Empty;
for (int i = 0; i < maarr.Length; i++)
{
if (string.IsNullOrEmpty(maarr[i].ToString()))
{
continue;
}
strText += maarr[i].ToString() + "
";
}
查询时 将 "
" 替换为 "
"
this.txtTeachingPlan.Text = dt.Rows[0]["TeachingPlan"].ToString().Replace( "
","
");
Environment.NewLine; 获得环境中的定义的换行字符串 (保持平台的通用性)