Click here to Skip to main content
16,004,882 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I tried my best to make the retrieved data from a table to lower and show in listbox1. The ToLOwer() is not working as like in DDL. Can any help?
My code:
C#
adds1.Add("SELECT");
            for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
            {

                adds1.Add(ds1.Tables[0].Rows[i].ItemArray[0].ToString());
                name1 = ds1.Tables[0].Rows[i]["block_name"].ToString().ToLower();
                v_proceed_tag = "";

            }
            ListBox1.DataSource = adds1;
            ListBox1.DataBind();
            ListBox1.Visible = true;
Posted
Comments
Zoltán Zörgő 26-Dec-12 9:03am    
In DDL?
ToLower not working?
How that?
Please elaborate your question a little bit more, I can not figure out, what your problem is, and what this code should do exactly.
By the way, you can even lowercase in the query itself, if you don't know any better: http://msdn.microsoft.com/en-us/library/ms174400.aspx

Try:

C#
adds1.Add("SELECT");
            for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
            {

                adds1.Add(ds1.Tables[0].Rows[i].ItemArray[0].ToString().ToLower());
                name1 = ds1.Tables[0].Rows[i]["block_name"].ToString().ToLower();
                v_proceed_tag = "";

            }
            ListBox1.DataSource = adds1;
            ListBox1.DataBind();
            ListBox1.Visible = true;
 
Share this answer
 
Hi,

in DDL (SQL Server) there is no function named toLower() function is Lower([Column Name])

in your case you can try this

adds1.Add(ds1.Tables[0].Rows[i].ItemArray[0].ToString().ToLower());


but don't use Index while fetching data from DataTable or DataSet because its erroneous use Column Name or Table Name.

Thanks
Suvabrata
 
Share this answer
 

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