Solved

Help with combining two like statements

Posted on 2011-02-10
2
263 Views
Last Modified: 2012-06-22
Hello,

I'm trying to combine to Like statements with the following code (VB.NET):

 Dim DVa As New DataView(dta, "Parent_Item like " & "'" & C1TrueDBGrid1.Columns(4).Value & "'" Or "Child_Item like  " & "'" & C1TrueDBGrid1.Columns(4).Value & "'", Nothing, DataViewRowState.CurrentRows)

But I'm getting the folowing error:

Conversion from string "Parent_Item like 'M107'" to type 'Long' is not valid.

Can you please help me fix thids problem. The code was working well until I added the second Like statement.

Thanks,

Victor
0
Comment
Question by:vcharles
[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
2 Comments
 
LVL 23

Accepted Solution

by:
wdosanjos earned 500 total points
ID: 34867685
Please try the following:

  Dim DVa As New DataView(dta, "Parent_Item like '" & C1TrueDBGrid1.Columns(4).Value & "' Or Child_Item like '" & C1TrueDBGrid1.Columns(4).Value & "'", Nothing, DataViewRowState.CurrentRows)
0
 

Author Comment

by:vcharles
ID: 34867730
It worked.

Thank you very much.

Victor
0

Featured Post

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

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

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…

739 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