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
Solved

Help with combining two like statements

Posted on 2011-02-10
2
262 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
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

808 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