Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

checking the value in a table.

$
0
0

let  I have a table called test and another table called  testTwo.

I got a value (row) from table test which isrollNo.
Now i want to check and compare that if there is any row called  rollNo exists in my  testTwo table. 

How can i do this in asp.net? Thanks. 

I am adding some sample code here to get the concept that what i am trying to do. 

int? rollNO = null; 

if (((DataRowView)e.Item.DataItem).Row["rollNO"].ToString() != null && ((DataRowView)e.Item.DataItem).Row["rollNO"].ToString().Trim().Length > 0)
                {
                    rollNO= Int32.Parse(((DataRowView)e.Item.DataItem).Row["rollNO"].ToString());
                }






if (((DataRowView)e.Item.DataItem).Row["IsActiveStatus"].ToString() == "False")
                {
                    if (here i want to check that if rollNO row exists in testTwo table)
                    {
                        item.CssClass = "Green" + " rgRow";
                    }
                    else
                    {
                        item.CssClass = "Red" + " rgRow";
                    }
                }


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>