Solved

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

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

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 40

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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 …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now