Solved

Help with combining two like statements

Posted on 2011-02-10
2
255 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
Comment Utility
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
Comment Utility
It worked.

Thank you very much.

Victor
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
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…
This video discusses moving either the default database or any database to a new volume.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

728 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

13 Experts available now in Live!

Get 1:1 Help Now