Click here to Skip to main content
15,902,939 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to show tables columns values where field not null i mean i dont want to show null values on formload

What I have tried:

C#
connection.Open();
                DataSet dsa = new DataSet();
                DataTable dt = new DataTable();
                dsa.Tables.Add(dt);
                OleDbDataAdapter da = new OleDbDataAdapter();
                da = new OleDbDataAdapter("SELECT [Order Status] from [Contacts]", connection);
                da.Fill(dt);
                order1.DataSource = dt;
                order1.DisplayMember = "Order Status";
                connection.Close();
Posted
Updated 17-Oct-16 23:55pm

Where [order status] is not null
 
Share this answer
 
Comments
Member 9983063 13-Oct-16 17:48pm    
it's not working showing null
try this

C#
dt.AsEnumerable().ToList().ForEach(row=>
            { if (string.IsNullOrWhiteSpace(Convert.ToString(row[0]))) row.Delete(); });
           dt.AcceptChanges();
 
Share this answer
 
HI,

Try the following query.See if it helps:

SELECT [Order Status] from [Contacts] where [Order Status] Not NULL or  [Order Status] != ''
 
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