前台:
<asp:TextBox ID="TextBox1" runat="server" TextMode="MultiLine"></asp:TextBox> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> <br /> <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
后台 插入数据库text_table中。
string txt = TextBox1.Text; StringBuilder strSql = new StringBuilder(); strSql.Append("insert into text_table "); strSql.Append("values("); strSql.Append("'" + "',''" + ",''" + ",''" + ",''" + ",'" + "','" + TextBox1.Text + "'"); strSql.Append(")"); int countcj = DbHelperSQL.ExecuteSql(strSql.ToString()); DataSet ds = DbHelperSQL.Query("select * from text_table where a='3'"); string strtext = ds.Tables[0].Rows[0]["bz"].ToString(); TextBox1.Text = strtext; Label2.Text = TextBox1.Text.Replace(" ", " <br>");