我的MSSQL2000表中有一个content字段,类型为ntext
我想插入文本数据,可怎么也插入不了,简单的数据可以插入,以下是我的一个表单提交的一个文本数据:<STYLE>
<!--
 /* Font Definitions */
 @font-face
 {font-family:宋体;
 panose-1:2 1 6 0 3 1 1 1 1 1;
 mso-font-alt:SimSun;
 mso-font-charset:134;
 mso-generic-font-family:auto;
 mso-font-pitch:variable;
 mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
 {font-family:"\@宋体";
 panose-1:2 1 6 0 3 1 1 1 1 1;
 mso-font-charset:134;
 mso-generic-font-family:auto;
 mso-font-pitch:variable;
 mso-font-signature:3 135135232 16 0 262145 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
 {mso-style-parent:"";
 margin:0cm;
 margin-bottom:.0001pt;
 text-align:justify;
 text-justify:inter-ideograph;
 mso-pagination:none;
 font-size:10.5pt;
 mso-bidi-font-size:12.0pt;
 font-family:"Times New Roman";
 mso-fareast-font-family:宋体;
 mso-font-kerning:1.0pt;}
p.MsoHeader, li.MsoHeader, div.MsoHeader
 {margin:0cm;
 margin-bottom:.0001pt;
 text-align:center;
 mso-pagination:none;
 tab-stops:center 207.65pt right 415.3pt;
 layout-grid-mode:char;
 border:none;
 mso-border-bottom-alt:solid windowtext .75pt;
 padding:0cm;
 mso-padding-alt:0cm 0cm 1.0pt 0cm;
 font-size:9.0pt;
 font-family:"Times New Roman";
 mso-fareast-font-family:宋体;
 mso-font-kerning:1.0pt;}
p.MsoFooter, li.MsoFooter, div.MsoFooter
 {margin:0cm;
 margin-bottom:.0001pt;
 mso-pagination:none;
 tab-stops:center 207.65pt right 415.3pt;
 layout-grid-mode:char;
 font-size:9.0pt;
 font-family:"Times New Roman";
 mso-fareast-font-family:宋体;
 mso-font-kerning:1.0pt;}
 /* Page Definitions */
 @page
 {mso-page-border-surround-header:no;
 mso-page-border-surround-footer:no;
 mso-footnote-separator:url("eWebEditor_Temp_Word_Doc.files/header.html") fs;
 mso-footnote-continuation-separator:url("eWebEditor_Temp_Word_Doc.files/header.html") fcs;
 mso-endnote-separator:url("eWebEditor_Temp_Word_Doc.files/header.html") es;
 mso-endnote-continuation-separator:url("eWebEditor_Temp_Word_Doc.files/header.html") ecs;}
@page Section1
 {size:595.3pt 841.9pt;
 margin:72.0pt 90.0pt 72.0pt 90.0pt;
 mso-header-margin:42.55pt;
 mso-footer-margin:49.6pt;
 mso-even-header:url("eWebEditor_Temp_Word_Doc.files/header.html") eh1;
 mso-header:url("eWebEditor_Temp_Word_Doc.files/header.html") h1;
 mso-even-footer:url("eWebEditor_Temp_Word_Doc.files/header.html") ef1;
 mso-footer:url("eWebEditor_Temp_Word_Doc.files/header.html") f1;
 mso-first-header:url("eWebEditor_Temp_Word_Doc.files/header.html") fh1;
 mso-first-footer:url("eWebEditor_Temp_Word_Doc.files/header.html") ff1;
 mso-paper-source:0;
 layout-grid:15.6pt;}
div.Section1
 {page:Section1;}
-->
</STYLE><STYLE>
 /* Style Definitions */
 table.MsoNormalTable
 {mso-style-name:普通表格;
 mso-tstyle-rowband-size:0;
 mso-tstyle-colband-size:0;
 mso-style-noshow:yes;
 mso-style-parent:"";
 mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
 mso-para-margin:0cm;
 mso-para-margin-bottom:.0001pt;
 mso-pagination:widow-orphan;
 font-size:10.0pt;
 font-family:"Times New Roman";
 mso-ansi-language:#0400;
 mso-fareast-language:#0400;
 mso-bidi-language:#0400;}
</STYLE><DIV class=Section1 style="LAYOUT-GRID:  15.6pt none">
<P class=MsoNormal><SPAN lang=EN-US>a</SPAN></P></DIV>求各位帮忙,我该咋办?

解决方案 »

  1.   

    我只是想把上面的文本插入到content字段中,如果只是简单的是可以插入的
    但上面数据为什么不行,我该咋办?
      

  2.   

    不超过8000的,暂时可以用这个declare @s varchar(8000)
    set @s='<STYLE>
    <!--
     /* Font Definitions */
     @font-face
     {font-family:宋体;
     panose-1:2 1 6 0 3 1 1 1 1 1;
     mso-font-alt:SimSun;
     mso-font-charset:134;
     mso-generic-font-family:auto;
     mso-font-pitch:variable;
     mso-font-signature:3 135135232 16 0 262145 0;}
    @font-face
     {font-family:"\@宋体";
     panose-1:2 1 6 0 3 1 1 1 1 1;
     mso-font-charset:134;
     mso-generic-font-family:auto;
     mso-font-pitch:variable;
     mso-font-signature:3 135135232 16 0 262145 0;}
     /* Style Definitions */
     p.MsoNormal, li.MsoNormal, div.MsoNormal
     {mso-style-parent:"";
     margin:0cm;
     margin-bottom:.0001pt;
     text-align:justify;
     text-justify:inter-ideograph;
     mso-pagination:none;
     font-size:10.5pt;
     mso-bidi-font-size:12.0pt;
     font-family:"Times New Roman";
     mso-fareast-font-family:宋体;
     mso-font-kerning:1.0pt;}
    p.MsoHeader, li.MsoHeader, div.MsoHeader
     {margin:0cm;
     margin-bottom:.0001pt;
     text-align:center;
     mso-pagination:none;
     tab-stops:center 207.65pt right 415.3pt;
     layout-grid-mode:char;
     border:none;
     mso-border-bottom-alt:solid windowtext .75pt;
     padding:0cm;
     mso-padding-alt:0cm 0cm 1.0pt 0cm;
     font-size:9.0pt;
     font-family:"Times New Roman";
     mso-fareast-font-family:宋体;
     mso-font-kerning:1.0pt;}
    p.MsoFooter, li.MsoFooter, div.MsoFooter
     {margin:0cm;
     margin-bottom:.0001pt;
     mso-pagination:none;
     tab-stops:center 207.65pt right 415.3pt;
     layout-grid-mode:char;
     font-size:9.0pt;
     font-family:"Times New Roman";
     mso-fareast-font-family:宋体;
     mso-font-kerning:1.0pt;}
     /* Page Definitions */
     @page
     {mso-page-border-surround-header:no;
     mso-page-border-surround-footer:no;
     mso-footnote-separator:url("eWebEditor_Temp_Word_Doc.files/header.html") fs;
     mso-footnote-continuation-separator:url("eWebEditor_Temp_Word_Doc.files/header.html") fcs;
     mso-endnote-separator:url("eWebEditor_Temp_Word_Doc.files/header.html") es;
     mso-endnote-continuation-separator:url("eWebEditor_Temp_Word_Doc.files/header.html") ecs;}
    @page Section1
     {size:595.3pt 841.9pt;
     margin:72.0pt 90.0pt 72.0pt 90.0pt;
     mso-header-margin:42.55pt;
     mso-footer-margin:49.6pt;
     mso-even-header:url("eWebEditor_Temp_Word_Doc.files/header.html") eh1;
     mso-header:url("eWebEditor_Temp_Word_Doc.files/header.html") h1;
     mso-even-footer:url("eWebEditor_Temp_Word_Doc.files/header.html") ef1;
     mso-footer:url("eWebEditor_Temp_Word_Doc.files/header.html") f1;
     mso-first-header:url("eWebEditor_Temp_Word_Doc.files/header.html") fh1;
     mso-first-footer:url("eWebEditor_Temp_Word_Doc.files/header.html") ff1;
     mso-paper-source:0;
     layout-grid:15.6pt;}
    div.Section1
     {page:Section1;}
    -->
    </STYLE><STYLE>
     /* Style Definitions */
     table.MsoNormalTable
     {mso-style-name:普通表格;
     mso-tstyle-rowband-size:0;
     mso-tstyle-colband-size:0;
     mso-style-noshow:yes;
     mso-style-parent:"";
     mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
     mso-para-margin:0cm;
     mso-para-margin-bottom:.0001pt;
     mso-pagination:widow-orphan;
     font-size:10.0pt;
     font-family:"Times New Roman";
     mso-ansi-language:#0400;
     mso-fareast-language:#0400;
     mso-bidi-language:#0400;}
    </STYLE><DIV class=Section1 style="LAYOUT-GRID:  15.6pt none">
    <P class=MsoNormal><SPAN lang=EN-US>a</SPAN></P></DIV>
    '
    update tb set content=@s
      

  3.   


    CREATE TABLE #t(VALUE nTEXT)INSERT INTO #t
    VALUES('
    <STYLE>
    <!--
     /* Font Definitions */
     @font-face
     {font-family:宋体;
     panose-1:2 1 6 0 3 1 1 1 1 1;
     mso-font-alt:SimSun;
     mso-font-charset:134;
     mso-generic-font-family:auto;
     mso-font-pitch:variable;
     mso-font-signature:3 135135232 16 0 262145 0;}
    @font-face
     {font-family:"\@宋体";
     panose-1:2 1 6 0 3 1 1 1 1 1;
     mso-font-charset:134;
     mso-generic-font-family:auto;
     mso-font-pitch:variable;
     mso-font-signature:3 135135232 16 0 262145 0;}
     /* Style Definitions */
     p.MsoNormal, li.MsoNormal, div.MsoNormal
     {mso-style-parent:"";
     margin:0cm;
     margin-bottom:.0001pt;
     text-align:justify;
     text-justify:inter-ideograph;
     mso-pagination:none;
     font-size:10.5pt;
     mso-bidi-font-size:12.0pt;
     font-family:"Times New Roman";
     mso-fareast-font-family:宋体;
     mso-font-kerning:1.0pt;}
    p.MsoHeader, li.MsoHeader, div.MsoHeader
     {margin:0cm;
     margin-bottom:.0001pt;
     text-align:center;
     mso-pagination:none;
     tab-stops:center 207.65pt right 415.3pt;
     layout-grid-mode:char;
     border:none;
     mso-border-bottom-alt:solid windowtext .75pt;
     padding:0cm;
     mso-padding-alt:0cm 0cm 1.0pt 0cm;
     font-size:9.0pt;
     font-family:"Times New Roman";
     mso-fareast-font-family:宋体;
     mso-font-kerning:1.0pt;}
    p.MsoFooter, li.MsoFooter, div.MsoFooter
     {margin:0cm;
     margin-bottom:.0001pt;
     mso-pagination:none;
     tab-stops:center 207.65pt right 415.3pt;
     layout-grid-mode:char;
     font-size:9.0pt;
     font-family:"Times New Roman";
     mso-fareast-font-family:宋体;
     mso-font-kerning:1.0pt;}
     /* Page Definitions */
     @page
     {mso-page-border-surround-header:no;
     mso-page-border-surround-footer:no;
     mso-footnote-separator:url("eWebEditor_Temp_Word_Doc.files/header.html") fs;
     mso-footnote-continuation-separator:url("eWebEditor_Temp_Word_Doc.files/header.html") fcs;
     mso-endnote-separator:url("eWebEditor_Temp_Word_Doc.files/header.html") es;
     mso-endnote-continuation-separator:url("eWebEditor_Temp_Word_Doc.files/header.html") ecs;}
    @page Section1
     {size:595.3pt 841.9pt;
     margin:72.0pt 90.0pt 72.0pt 90.0pt;
     mso-header-margin:42.55pt;
     mso-footer-margin:49.6pt;
     mso-even-header:url("eWebEditor_Temp_Word_Doc.files/header.html") eh1;
     mso-header:url("eWebEditor_Temp_Word_Doc.files/header.html") h1;
     mso-even-footer:url("eWebEditor_Temp_Word_Doc.files/header.html") ef1;
     mso-footer:url("eWebEditor_Temp_Word_Doc.files/header.html") f1;
     mso-first-header:url("eWebEditor_Temp_Word_Doc.files/header.html") fh1;
     mso-first-footer:url("eWebEditor_Temp_Word_Doc.files/header.html") ff1;
     mso-paper-source:0;
     layout-grid:15.6pt;}
    div.Section1
     {page:Section1;}
    -->
    </STYLE><STYLE>
     /* Style Definitions */
     table.MsoNormalTable
     {mso-style-name:普通表格;
     mso-tstyle-rowband-size:0;
     mso-tstyle-colband-size:0;
     mso-style-noshow:yes;
     mso-style-parent:"";
     mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
     mso-para-margin:0cm;
     mso-para-margin-bottom:.0001pt;
     mso-pagination:widow-orphan;
     font-size:10.0pt;
     font-family:"Times New Roman";
     mso-ansi-language:#0400;
     mso-fareast-language:#0400;
     mso-bidi-language:#0400;}
    </STYLE><DIV class=Section1 style="LAYOUT-GRID:  15.6pt none">
    <P class=MsoNormal><SPAN lang=EN-US>a</SPAN></P></DIV>')
      

  4.   

    插入提示成功,可是表里面什么数据都没有啊,其实我是用ewebeditor的ASP版本,ACCESS正常,可是换成MSSQL字段类型我做成NTEXT的,操作时提示成功,可是数据表里根本没有任何数据
    我的ASP主要代码如下:  Content = ""
    For I = 1 To Request.Form("Content").Count 
       Content = Content & Request.Form("Content")(I)
    Next
            ...连接MSSQL2000数据库略...
    set rs=server.createobject("adodb.recordset")
    sql="select top 1 * from Article where ArticleID = 0" 
    rs.open sql,conn,1,3
    rs.addnew
            rs("Content") = Content
    rs.close
            Set rs = Nothing我该咋办?
      

  5.   

    记得用text的时候,没遇到过这情况,是可以正常存储html代码的。你的添加文章的asp代码也放出来看看 :)
      

  6.   

    Content的数据值肯定为上面的文本数据无误(我Response.write测试过了),就是插入不到数据表中,提示也成功了,结果是无数据,如果我去编辑,则提示:无法编辑该单元格。
      

  7.   

    主要代码如下:
    <form method="POST" name="myform" onSubmit="return checkForm()" action="Save.asp">
    <INPUT type="hidden" name="Content" value="">
    <IFRAME ID="eWebEditor1" src="/ewebeditor/ewebeditor.htm?id=Content&style=standard600&skin=officexp&originalfilename=d_originalfilename&savefilename=d_savefilename&savepathfilename=d_savepathfilename" frameborder="0" scrolling="no" width="600" height="350"></IFRAME>
    <input type="submit" name="Add" id="Add" value=" 添 加 " style="cursor:hand;">
    </form>
    表单提交后,Content的内容已经被提交过来了,这儿我已经确认无误(使用Response.write)
    Save.asp的主要代码
         Content = ""
        For I = 1 To Request.Form("Content").Count 
           Content = Content & Request.Form("Content")(I)
        Next
        Response.write Content  '显示完全正确,但写入到数据表里就不行了
            ...连接MSSQL2000数据库略...
        set rs=server.createobject("adodb.recordset")
        sql="select top 1 * from Article where ArticleID = 0" 
        rs.open sql,conn,1,3
        rs.addnew
            rs("Content") = Content
        rs.close
        Set rs = Nothing
      

  8.   

    再检查下你的代码逻辑吧。
    use tempdb
    gocreate table t(id int identity(1,1),content ntext)insert into t (content)
    select '
    <STYLE>
    <!--
     /* Font Definitions */
     @font-face
     {font-family:宋体;
     panose-1:2 1 6 0 3 1 1 1 1 1;
     mso-font-alt:SimSun;
     mso-font-charset:134;
     mso-generic-font-family:auto;
     mso-font-pitch:variable;
     mso-font-signature:3 135135232 16 0 262145 0;}
    @font-face
     {font-family:"\@宋体";
     panose-1:2 1 6 0 3 1 1 1 1 1;
     mso-font-charset:134;
     mso-generic-font-family:auto;
     mso-font-pitch:variable;
     mso-font-signature:3 135135232 16 0 262145 0;}
     /* Style Definitions */
     p.MsoNormal, li.MsoNormal, div.MsoNormal
     {mso-style-parent:"";
     margin:0cm;
     margin-bottom:.0001pt;
     text-align:justify;
     text-justify:inter-ideograph;
     mso-pagination:none;
     font-size:10.5pt;
     mso-bidi-font-size:12.0pt;
     font-family:"Times New Roman";
     mso-fareast-font-family:宋体;
     mso-font-kerning:1.0pt;}
    p.MsoHeader, li.MsoHeader, div.MsoHeader
     {margin:0cm;
     margin-bottom:.0001pt;
     text-align:center;
     mso-pagination:none;
     tab-stops:center 207.65pt right 415.3pt;
     layout-grid-mode:char;
     border:none;
     mso-border-bottom-alt:solid windowtext .75pt;
     padding:0cm;
     mso-padding-alt:0cm 0cm 1.0pt 0cm;
     font-size:9.0pt;
     font-family:"Times New Roman";
     mso-fareast-font-family:宋体;
     mso-font-kerning:1.0pt;}
    p.MsoFooter, li.MsoFooter, div.MsoFooter
     {margin:0cm;
     margin-bottom:.0001pt;
     mso-pagination:none;
     tab-stops:center 207.65pt right 415.3pt;
     layout-grid-mode:char;
     font-size:9.0pt;
     font-family:"Times New Roman";
     mso-fareast-font-family:宋体;
     mso-font-kerning:1.0pt;}
     /* Page Definitions */
     @page
     {mso-page-border-surround-header:no;
     mso-page-border-surround-footer:no;
     mso-footnote-separator:url("eWebEditor_Temp_Word_Doc.files/header.html") fs;
     mso-footnote-continuation-separator:url("eWebEditor_Temp_Word_Doc.files/header.html") fcs;
     mso-endnote-separator:url("eWebEditor_Temp_Word_Doc.files/header.html") es;
     mso-endnote-continuation-separator:url("eWebEditor_Temp_Word_Doc.files/header.html") ecs;}
    @page Section1
     {size:595.3pt 841.9pt;
     margin:72.0pt 90.0pt 72.0pt 90.0pt;
     mso-header-margin:42.55pt;
     mso-footer-margin:49.6pt;
     mso-even-header:url("eWebEditor_Temp_Word_Doc.files/header.html") eh1;
     mso-header:url("eWebEditor_Temp_Word_Doc.files/header.html") h1;
     mso-even-footer:url("eWebEditor_Temp_Word_Doc.files/header.html") ef1;
     mso-footer:url("eWebEditor_Temp_Word_Doc.files/header.html") f1;
     mso-first-header:url("eWebEditor_Temp_Word_Doc.files/header.html") fh1;
     mso-first-footer:url("eWebEditor_Temp_Word_Doc.files/header.html") ff1;
     mso-paper-source:0;
     layout-grid:15.6pt;}
    div.Section1
     {page:Section1;}
    -->
    </STYLE><STYLE>
     /* Style Definitions */
     table.MsoNormalTable
     {mso-style-name:普通表格;
     mso-tstyle-rowband-size:0;
     mso-tstyle-colband-size:0;
     mso-style-noshow:yes;
     mso-style-parent:"";
     mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
     mso-para-margin:0cm;
     mso-para-margin-bottom:.0001pt;
     mso-pagination:widow-orphan;
     font-size:10.0pt;
     font-family:"Times New Roman";
     mso-ansi-language:#0400;
     mso-fareast-language:#0400;
     mso-bidi-language:#0400;}
    </STYLE><DIV class=Section1 style="LAYOUT-GRID:  15.6pt none">
    <P class=MsoNormal><SPAN lang=EN-US>a</SPAN></P></DIV>
    '/*(1 行受影响)*/select * from t/*id          content
    ----------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    1           
    <STYLE>
    <!--
     /* Font Definitions */
     @font-face
     {font-family:宋体;
     panose-1:2 1 6 0 3 1 1 1 1 1;
     mso-font-alt:SimSun;
     mso-font-charset:134;
     mso-generic-font-family:auto;
     mso-font-pitch:variable;
     mso-font-signature:3 135135232 16 0 262145 (1 行受影响)
    */
      

  9.   

    Save.asp的主要代码
      Content = ""
      For I = 1 To Request.Form("Content").Count  
      Content = Content & Request.Form("Content")(I)
      Next
      Response.write Content '显示完全正确,但写入到数据表里就不行了
      ...连接MSSQL2000数据库略...
      set rs=server.createobject("adodb.recordset")
      sql="select top 1 * from Article where ArticleID = 0"  
      rs.open sql,conn,1,3
      rs.addnew
      rs("Content") = Content
      rs.update
      rs.close
      Set rs = Nothing
    不好意思上面打掉rs.addnew了,我调试中有这句,我该咋办?
      

  10.   

    "SELECT" 子句必须在读所有非 BLOB 列后再 读 BLOB 类型列的值.    Content = ""
        For I = 1 To Request.Form("Content").Count 
           Content = Content & Request.Form("Content")(I)
        Next
            ...连接MSSQL2000数据库略...
        set rs=server.createobject("adodb.recordset")
        sql="select top 1 Content from Article where ArticleID = 0" 
        rs.open sql,conn,1,3
        rs.addnew
            rs("Content") = Content
        rs.close
            Set rs = Nothing
      

  11.   

    For I = 1 To Request.Form("Content").Count   Request.Form("Content").Count    应该为0 吧,能这样for 吗?rs.update()
    但你的rs 是select的。。能这样做吗?对asp不熟。。
      

  12.   

    哇,真的谢谢各位,我一直是在MSSQL控制台里面下sql语句的,结果看到的是空白,我还认为没数据,在上面编辑,提示“无法编辑该单元格”
    后来,无意中看到查询分析器,抱着试试的态度,语句输入执行后,还真有数据在里面
    我有些不明白,为什么在控制台里面显示不出来,在查询分析器里就显示出部分出来了
    真诚谢谢各位帮忙!