Solved

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

Posted on 2013-05-14
5
184 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

734 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