Solved

How to check for the same data/or compare the data in the database?

Posted on 2013-05-14
5
183 Views
Last Modified: 2013-05-16
Hi Experts,

I have a situation where I need to check where the two different entities M & S have the same range. If they have the same range then I need to draw a diagram on the both M & S. If they do not match up then i need to just draw a diagram on M. How to check and search through the data in sql server?  Thanks
0
Comment
Question by:developer2012
5 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 39165803
So two different rows in the database? Or are you trying to compare two tables?
0
 

Author Comment

by:developer2012
ID: 39165914
two different rows in the database.
0
 

Author Comment

by:developer2012
ID: 39165925
Two different rows
0
 
LVL 41

Expert Comment

by:Sharath
ID: 39166035
Can you post some sample data with expected result?
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
ID: 39167506
Here is an example
Note that I used dummy names such as EntityName, EntityValue which you will need to replace with your actual column names.

Dim dbadp As New System.Data.SqlClient.SqlDataAdapter("Select * From tablename Where EntityName In ('M', 'S')", "Your connectionstring here")
Dim dTable As New System.Data.DataTable
dbadp.Fill(dTable)
dbadp.Dispose

if dTable.Rows.Count = 2 Then
   If dTable.Rows(0).Item("EntityValue") = dTable.Rows(1).Item("EntityValue") Then
      'Same value
   Else
      'Different value
   End If
End If

Open in new window

0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question