日期:2014-05-18  浏览次数:20435 次

【加急求助】FCKeditor 2.6 如何将编辑信息保存到SQLServer数据库?又如何从数据库读取显示到页面?
C# code

<--?界面-->
<!--编辑控件-->
    <div class="FCKeditorV">
        <FCKeditorV2:FCKeditor ID="FCKeditor" runat="server" Height="400px"></FCKeditorV2:FCKeditor> 
    </div>
     <!--保存操作-->
    <div class="opear">
        <asp:Button ID="ButtonSava" runat="server" Text="保存" OnClick="ButtonSava_Click" />
        <asp:TextBox ID="TextBoxTitle" runat="server"></asp:TextBox>
    </div>
     <!--显示区域-->
    <div class="Literal1">
        <asp:Literal ID="Literal1" runat="server"></asp:Literal>
    </div>

//?保存事件
 protected void ButtonSava_Click(object sender, EventArgs e)
    {
        string strValue = this.FCKeditor.Value;//获取编辑器中的内容
        //传递编辑文本标题、编辑内容和编辑时间到业务层
        if (Opear.GetAddBool(TextBoxTitle.Text, strValue, DateTime.Now))
        {//操作成功提示
            WebMS.Show("成功!");
        }
        else
        {//操作失败提示
            WebMS.Show("失败");
        }
    }

//?业务层保存方法
 public static bool GetAddBool(string strTitle,string strValue, DateTime dtTime)
    {        //业务层获取显示层参数设置参数文本
        SqlParameter[] parm ={
           DBServer.DBServerSQL.SetSqlParameter("@strTitle",SqlDbType.VarChar,50,strTitle),    
           DBServer.DBServerSQL.SetSqlParameter("@strValue",SqlDbType.Text,16,strValue),       
           DBServer.DBServerSQL.SetSqlParameter("@dtTime",SqlDbType.DateTime,8,dtTime)
       };        //SqlDbType.Text,16??????怎么长度这么小?
        string strSQL = string.Format("insert into tb_FCKeditorV2 (strTitle,strValue,dtTime) values(@strTitle,@strValue,@dtTime)");//执行语句
        //通过数据层进行保存操作
        //返回相关操作状态信息
        return DBServer.DBServerSQL.GetExecuteNonQueryBool(strSQL, parm);
    }

//?数据层操作
 /// <summary>
        /// 返回ExecuteNonQuery受影响的Boolean类型(有参数文本)
        /// </summary>
        /// <param name="strSQL">执行语句</param>
        /// <param name="prams">参数对象</param>
        /// <returns></returns>
        public static Boolean GetExecuteNonQueryBool(string strSQL, SqlParameter[] prams)
        {
            Boolean BIsOK = false;
            try
            {
                SqlCommand cmd = CreateCommand(strSQL, prams);
                if (cmd.ExecuteNonQuery() > 0)
                {//说明操作成功
                    BIsOK = true;
                }
                CloseConn();
            }
            catch { }
            return BIsOK;
        }




各位前辈学长,不知道有没有FCKeditorV2相关与数据库存、读操作的实例?如何保存到数据库?又如何显示到页面?

有FreeTextBox操作方法也可以,希望能讲解与数据库存、读操作的实例,O(∩_∩)O谢谢了……

如果有图片又怎么办?


------解决方案--------------------
HTML code


<%@ Register Assembly="FreeTextBox" Namespace="FreeTextBoxControls" TagPrefix="FTB" %>
                                                    <FTB:FreeTextBox ID="FreeTextBox1" runat="server" Width="500px" Height="300px">
                                                    </FTB:FreeTextBox>

------解决方案--------------------
自己不已经写了吗。
通过sqlhelper查询数据库获取值
fckeditor.value=ds.Table[0]["strValue"].ToString();
------解决方案--------------------

------解决方案--------------------
显示可用literal控件显示内容
或string strcontent=ds.Table[0]["strValue"].ToString();
<%=strcontent%>