?
Solved

The "IN_KEYWORD" excpetion in vb.net?

Posted on 2012-08-28
4
Medium Priority
?
1,220 Views
Last Modified: 2012-08-29
I get this exception when I  selected the particular value from the drop down list. It does not happen with other values but just with the one.
The IN keyword must be followed by a non-empty list of expressions separated by commas, and also must be enclosed in parentheses.
HEre is the code

     Dim dViewEmp As DataView = New DataView(dsEmp.Tables(0), "UID  not in (" & strbldr.ToString & ")", "UID", DataViewRowState.CurrentRows)

Open in new window


Any ideas? It works good with other selected values.  Thanks!
0
Comment
Question by:developer2012
  • 2
4 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 1500 total points
ID: 38343398
What is the value of strbldr at the time the exception is encountered?
0
 
LVL 26

Expert Comment

by:Alan Warren
ID: 38343765
Hi developer2012,
maybe something like this:
    Dim strbldr As New StringBuilder
    ' populate your stringbuilder with ID's like "1,2,3,4,5,6,207,901"
    
    Dim dViewEmp As System.Data.DataView = Nothing
    
    If strbldr.ToString.Length > 0 Then
      ' Populate the DataView with filtered data.
      dViewEmp = New System.Data.DataView(dsEmp.Tables(0), "UID  not in (" & strbldr.ToString & ")", "UID", System.Data.DataViewRowState.CurrentRows)
    Else
      ' Populate the DataView with unfiltered data
      dViewEmp = New System.Data.DataView(dsEmp.Tables(0))
    End If

Open in new window

Alan ";0)
0
 

Author Comment

by:developer2012
ID: 38346483
I will try this and let you know. Sorry for the late response...
0
 

Author Comment

by:developer2012
ID: 38347495
When I put the break point and checked in the database. there is no UID assoicated with that particular  value.resolved my issue. Thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

862 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