从数据库中这样读取
select '名称:'+cname+char(13)+'规格:'+cmodel from table1 where code=@code
然后excutescalar得到的string,赋值于textbox.text,为什么这样不会换行?
怎么解决这个问题?

解决方案 »

  1.   

    textbox的multiline已经设置为true,用键盘敲进去没事
      

  2.   

    string str="数据库里数据".replace(((char)13).ToString(),"<br/>");
    Textbox1.Text=str;
      

  3.   

    是winform
    ((string)cmd.excutescalar()).replace((char)13,'\r')这样不是完全没意义吗?(char)13本身不就是'\r'吗?
      

  4.   

    是不是excutescalar的时候吧char(13)给过滤掉了?
      

  5.   

    你这样在SQL中执行应该没问题的,要用文本显示哦,不过在程序中可能是读取的问题
      

  6.   

    里面有个函数了,\r\n、cname+char(13)这些没效果了不过函数名我一下也想不起来,MSDN下就有了
      

  7.   

    问题解决了
    select '名称:'+cname+char(13)+char(10)+'规格:'+cmodel from table1 where code=@code