如何使用c#,net动态地在textarea中添加文本?(how to add text in textarea dynamically using c#,net)

   IT问题网   2020-06-27 00:00:00

问 题

  string  query =  string  .empty; 
query = " select messages from comments";
odbcconnection con = new odbcconnection(str);
con.open();
odbccommand cmd = new odbccommand(query,con);
odbcdataadapter adap = new odbcdataadapter(cmd);
dataset ds = new dataset();
adap.fill(ds," results");
// 字符串temp_msg ="";
foreach (datarow row in ds.tables [" results"]。行)
{
this .comments.value + = row [" messages"]。tostring();

this .comments.value = environment.newline;
}




以上是我用来显示textarea中的消息的代码..但它没有显示任何内容..但价值正在检索..我们有任何其他想法..请告诉我.. 因为它非常紧急 ..真的在寻找你的帮助..



谢谢

问候

velu

解决方案

  .comments.value + = row [" 消息"]的tostring(); 

this .comments.value = environment.newline;
也许如果第二行是 "+ ="而不是"="它会有所作为吗?



顺便说一句:这会很有意义用stringbuilder替换 this.comments.value - 特别是如果预计有很多行 - 记住字符串在c#中是不可变的,所以你创建一个新的字符串每次你连接其中两个。

标签:如何使用动态添加文本



分享:

  • 微信
  • QQ好友
  • QQ空间
  • 新浪微博


热门推荐

在Visual Studio 2010中创建Crystal Reports(Creating Crystal Reports in Visual Studio 2010)

problem im creating crystal reports using visual studio 2 ...

控制以填充数据并执行回发(control to fill the data and perform postback)

problem hi, is there any control to fill the data from da ...

System()vs CreateProcess()vs ShellExecute()(System() vs CreateProcess() vs ShellExecute())

problem here''s one for everyone, i''m running a batch fi ...

将TCL代码转换为C ++ ...(Convert a TCL code to C++...)

problem for {set i 128} {$ilt;256} {incr i 1} { eval lut ...

如何从二进制文件中读取浮点值(How Read Float value from Binary File)

problem hi. i do want to read float value from binary fi ...

使用.bak文件还原数据库(Restore Database using.bak file)

problem good evening everybody, please say how to restor ...

在gridview中显示总和(Show sum In gridview)

problem my gridview has data which looks like below (for ...

Ajax客户端脚本错误(Ajax Client side script error)

problem if (typeof(sys) === #39;undefined#39; ...

如何在UP和DOWN键进行编码(How to code at the UP and DOWN key)

problem i want to move picture box up and down when a use ...

如何计算excel 2003中的时间平均值(how to calculate time averge in excel 2003)

problem hii to all. if any body knows how to calculateave ...

控制相关问题(Control related issue)

problem respected sir, i have a page in which i m gettin ...

在运行时动态绘制div(draw div dynamically at runtime)

problem hiii all, i have a page which i draw all its attr ...

转换数据库值(Convert a databse value)

problem i have a table one field is price and ...

如何使单元格的内容可见为false(How do i make the content of a cell visible false)

problem how do i make the content of a cell visible false ...

qtwebkit并连接cpp和javascript(qtwebkit and connect cpp and javascript)

problem hi to all i am using qwebkit i have a cpp object ...

response.flush&到Response.End(problem with response.flush & response.end)

problem hello everybody, i have used response.flush() wi ...

ShellExecute()不执行(ShellExecute() Not Executing)

problem i''m running a batch file from c++ code.when i ru ...

Radion Button使用Javascript隐藏/可见(Radion Button Hide/Visible Using Javascript)

problem i want hide/visible radio button using javascript ...

如何在此xml文件中插入/删除节点(how to insert/delete a node to this xml file)

problem hi all :) i search in webto find a code that ins ...

XML + DTD,不会出现在浏览器中(XML + DTD, won't show up in browser)

problem my code looks right, validates, but when i open i ...