SqlDataReader problem while showing data in <td>rdr.getvalue(2)</td>

hi.

i am having a problem while showing my data through sqldatareader in C# asp.net web application.

the  Problem is the sqldatareader object doesnt shows data on the newline.

let say the data in sql table is

"hi

my name is

measum"

now when i show this data through <td>rdr.getvalue(0)</td> it will show like

"hi my name is measum" (c no line break)

however when i put this data into the textbox(multiline) with the same object, its ok.

could anyone tell me wheres the problem...

thnx



Answer this question

SqlDataReader problem while showing data in <td>rdr.getvalue(2)</td>

  • fabal

    Hi!

    try following:

    rdr.getvalue(0).ToString().Replace(Environment.NewLine, "<br>")

    cheers

    Sohail.



  • Horky

    thnkx sohail.

    you did it... :)


  • tichu

    try this out:

    <td><PRE>rdr.getvalue(0)</PRE></td>

    does this work


  • Joshman

    na

    Pre doesnt helped me out.

    could u tell me someother way out


  • ajay_ndelhi

    isn't that a problem with the html code in stead of the return value of the sqldatareader, if it's putting it correct in a multiline textbox.

    Maybe you should change your html code to support CRLF.

    grtz


  • Carl213

    you can take a look at the html specs to see how print such text on a html page.

    * Plop69 is not a expert in HTML.


  • SqlDataReader problem while showing data in <td>rdr.getvalue(2)</td>