strSql1   =   "select   title,govAgentName,companyName,tb_govAgentApplication.releaseDate,REPLACE(Detailinfo,'\n',' <p> ')   as   Detailinfo" 
                        +   "   from   tb_govAgentApplication,tb_RegisterCompany,tb_govAgentGroup" 
                        +   "   where   tb_govAgentApplication.applicationID='"   +   applicationID 
                        +   "'   and   tb_govAgentApplication.companyID=   tb_RegisterCompany.companyID" 
                        +   "   and   tb_govAgentApplication.govAgentID=tb_govAgentGroup.govAgentID"; 

解决方案 »

  1.   

    粗看是没什么问题,关键就是看where中的?=?类型有没有匹配,
    你可以执行一样,看提示什么错误,现做分析。
      

  2.   

    lz遇到了什么问题??发出来看看..报错?推荐单步调试,看看sql语句是啥
      

  3.   

    strSql1   =@"select   title,govAgentName,companyName,tb_govAgentApplication.releaseDate,REPLACE(Detailinfo,'\n',' <p> ')   as   Detailinfo 
                            from   tb_govAgentApplication,tb_RegisterCompany,tb_govAgentGroup" 
                            where   tb_govAgentApplication.applicationID="   +   applicationID 
                            and   tb_govAgentApplication.companyID=   tb_RegisterCompany.companyID" 
                            and   tb_govAgentApplication.govAgentID=tb_govAgentGroup.govAgentID"; 
    replace不可以在select主句出现吧...
      

  4.   

    断点调试,然后把strSql1 语句直接复制到查询分析器运行,就知道有没有问题!
      

  5.   

    select   title,govAgentName,companyName,tb_govAgentApplication.releaseDate,
    replace(Detailinfo,'\n','<p>')   as   Detailinfo
    from   tb_govAgentApplication a inner join tb_RegisterCompany b
    on a.companyID=b.companyID inner join tb_govAgentGroup c
    on a.govAgentID=c.govAgentID
    where a.applicationID='applicationID'
    正规一点
      

  6.   

    replace()可以在主句中..定个select一试就知道了elect test,replace(test,'d','a') from table1
      

  7.   

    where a.applicationID='applicationID'
    applicationID不是数字值,需要加个引号
      

  8.   


    --try:strSql1 = "select title,govAgentName,companyName,tb_govAgentApplication.releaseDate,REPLACE(Detailinfo,'\n',' <p>') as Detailinfo" 
            + "  from   tb_govAgentApplication,tb_RegisterCompany,tb_govAgentGroup" 
            +   "   where   tb_govAgentApplication.applicationID='"   +   applicationID 
            +   "'   and   tb_govAgentApplication.companyID=   tb_RegisterCompany.companyID" 
            +   "   and   tb_govAgentApplication.govAgentID=tb_govAgentGroup.govAgentID"; 
      

  9.   

    用c#格式发:strSql1 = "select title,govAgentName,companyName,tb_govAgentApplication.releaseDate,REPLACE(Detailinfo,'\n',' <p>') as Detailinfo" 
            + "  from   tb_govAgentApplication,tb_RegisterCompany,tb_govAgentGroup" 
            +   "   where   tb_govAgentApplication.applicationID='"   +   applicationID 
            +   "'   and   tb_govAgentApplication.companyID=   tb_RegisterCompany.companyID" 
            +   "   and   tb_govAgentApplication.govAgentID=tb_govAgentGroup.govAgentID"; 
      

  10.   

    是在ASP。NET中用的吗?如果是的话, 里面有一个转义字符‘\’,在这个字符前面再加上‘\’,改成:REPLACE(Detailinfo,'\\n',' <p>')可以试一下
      

  11.   

    where   tb_govAgentApplication.applicationID="   +   applicationID 
    ======
    这句话后面的条件tb_govAgentApplication.applicationID这个字段是个字符串类型的吗?如果是的话,要加上单引号:
     "...where tb_govAgentApplication.applicationID='"+applicationID +"'....";
      

  12.   

    苦学wzg_love_sly的美妙语言...
    ps:我刚刚说错了,那个表别名就不要用as了.
      

  13.   

    REPLACE(Detailinfo,'\n',' <p> ')
    \n 是 C# 关键字...
    请用\\n
      

  14.   

    如想 Replace "\n"
    在 SQL 應該用 CHR(13) 或 CHR(13) + CHR(10) 代替
      

  15.   

    两个地方需要注意,一个是Replace   一个是 where条件 注意引号