Solved

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

Posted on 2013-05-14
5
185 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

691 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