private void button1_Click(object sender, EventArgs e)
{
conn.Open();
string sql = "insert into test values('" + richTextBox1.Rtf +"')";
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.ExecuteNonQuery();
cmd = new SqlCommand("select * from test ", conn);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
richTextBox2.Rtf = dr.GetValue(1).ToString();
}
dr.Close();
conn.Close();
}
提示下面语句中'cb'附近有语法错误,是转义字符的问题吗,应该怎么修改? "insert into test values('{\\rtf1\\ansi\\ansicpg936\\deff0\\deflang1033\\deflangfe2052{\\fonttbl{\\f0\\fnil\\fcharset134 \\'cb\\'ce\\'cc\\'e5;}}\r\n\\viewkind4\\uc1\\pard\\lang2052\\f0\\fs18 1111\\par\r\n}\r\n')"