前台代码 <!--在线留言-->
   <br />
   <table >
    <tr>
        <td>标题:</td>
        <td align="left"><asp:TextBox ID="txtTitle" runat="server"></asp:TextBox></td>
    </tr>
     <tr>
        <td valign="top">留言:</td>
        <td width="570" height="350" align="left">
    <iframe src="eWebEditor/eWebEditor.asp?id=txtMessage&style=s_light" width="100%" height="350" frameborder="0" scrolling="no"></iframe>
    <asp:TextBox ID="txtMessage" runat="server" style="display:none" TextMode="MultiLine"></asp:TextBox></td>
    </tr>
     <tr>
        <td></td>
        <td align="left"><asp:Button ID="btnSubmit" runat="server" Text="提交" OnClick="btnSubmit_Click" />
    <asp:Button ID="btnReset" runat="server" Text="重置" OnClick="btnReset_Click" /></td>
    </tr>
   </table>后台CS代码 //留言提交
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (this.txtTitle.Text.Equals(""))
        {
            Response.Write("<script>alert('标题不能为空!')</script>");
        }
        else if (this.txtMessage.Text.Equals(""))
        {
            Response.Write("<script>alert('留言内容不能为空!')</script>");
        }
        else
        {
            MessageInfo mes = new MessageInfo();
            mes.MesTitle = this.txtTitle.Text.ToString();
            mes.MesContent = this.txtMessage.Text.ToString();
            mes.Time = System.DateTime.Now;
            int num = BLL.MessageManager.AddMessage(mes);
            if (num > 0)
            {
                Response.Write("<script>alert('留言成功!');location.href='allMessage.aspx';</script>");
            }
            else
            {
                Response.Write("<script>alert('留言失败,请重新留言!')</script>");
            }
        }
    }报错:在此上下文中不允许使用名称 "eWebEditor"。有效表达式包括常量、常量表达式和变量(在某些上下文中)。不允许使用列名。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Data.SqlClient.SqlException: 在此上下文中不允许使用名称 "eWebEditor"。有效表达式包括常量、常量表达式和变量(在某些上下文中)。不允许使用列名。源错误: 
行 31:                     }
行 32:                     con.Open();
行 33:                     int count = cmd.ExecuteNonQuery();
行 34:                     con.Close();
行 35:                     return count;
 
源文件: F:\rtjs\DAL\DBHelper.cs    行: 33 堆栈跟踪: 
[SqlException (0x80131904): 在此上下文中不允许使用名称 "eWebEditor"。有效表达式包括常量、常量表达式和变量(在某些上下文中)。不允许使用列名。]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +857450
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +735062
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838
   System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) +192
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +380
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135
   DAL.DBHelper.ExecuteNonQuery(CommandType commandType, String commandText, SqlParameter[] sps) in F:\rtjs\DAL\DBHelper.cs:33
   DAL.MessageService.AddMessage(MessageInfo message) in F:\rtjs\DAL\MessageService.cs:21
   BLL.MessageManager.AddMessage(MessageInfo message) in F:\rtjs\BLL\MessageManager.cs:18
   message.btnSubmit_Click(Object sender, EventArgs e) in f:\rtjs\Web\message.aspx.cs:40
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint
 
这是哪里的问题?请各位大神帮忙哈.....

解决方案 »

  1.   

    <iframe src="eWebEditor/eWebEditor.asp?id=txtMessage&style=s_light" 
    eWebEditor.asp 是ASP页面?
      

  2.   


    恩,是啊,我用的就是ASP的这个,难道不行吗?
      

  3.   

    input type="hidden" runat='server" name="content"
    <IFRAME ID="eWebEditor1" src="eWebEditor/ewebeditor.htm?id=content" frameborder="0" scrolling="no" width="550" height="350"></IFRAME> 
    type="hidden" runat='server" name="content"
    content.Value
      

  4.   

    原先我用的是html的,但是没法上传本地的东西,只能上传网络上的图片、Flash或者媒体文件。
    如梦大神,帮瞧瞧我用ASP的这个为啥就不能插入Flash或者媒体,Models、DAL、BLL这3层我都检查了也没看出是哪里错来...
    郁闷....
      

  5.   


    不可能啊,html可以呢;我项目就是按5楼那样做的;你是不是没引用.
      

  6.   

    刚开始的时候我用的就是html的,后来又换成这个ASP的了,那你说我这个ASP的插入报错怎么回事?是哪里的问题?
      

  7.   

    可能是你的iis设置不对 不允许上传 大点的文件