Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
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");
        //String temp_msg = "";
        foreach (DataRow row in ds.Tables["results"].Rows)
        {
             this.comments.Value += row["messages"].ToString();
            
            this.comments.Value = Environment.NewLine;
        }


the above is the code i am using for showing the messages in textarea ..but it s not showing anything..but the values are retrieiving..do we have any other idea..pls let me know..since its very urgent..looking for ur help really..

thanks
regards
velu
Posted
Updated 27-Sep-11 14:55pm
v2

1 solution

C#
this.comments.Value += row["messages"].ToString();

this.comments.Value = Environment.NewLine;
Perhaps if the second line was also "+=" rather than "=" it would make a difference?

BTW: it would make a lot of sense to replace the this.comments.Value with a StringBuilder - particularly if there are expected to be a lot of rows - remember that strings are immutable in C# so you create a new string every time you concatenate two of them.
 
Share this answer
 
Comments
Iam Velu 27-Sep-11 12:24pm    
thank you so much man..it works

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900