Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

dataset problem

Posted on 2006-11-26
4
Medium Priority
?
247 Views
Last Modified: 2010-04-23
I have the following code :
what I am trying to do is test if two fields equal each other, then remove them from the dataset. The dataset has t_security default value set to 0 and will not allow nulls....

the string filter seems to be the problem

sqlStatement = " select masterid,cust_lastname,cust_signup,cust_security," & _
        "t_security,(cust_security-t_security) as xResult from master " & _
        "left outer join tblTerminate " & _
        "on masterid = bridge  "

        adaptVdb1 = New VistaDBDataAdapter(sqlStatement, conn)
        Mysecurity = New DataSet

        adaptVdb1.Fill(Mysecurity, "Master")

        Dim oTempTable As DataTable = Mysecurity.Tables("Master")
        Dim foundRows() As DataRow
        Dim getRow As DataRow
        Dim strFilter As String = "cust_security=0" <------------------works, it "cust_security = t_security", doesnt work, returns all records
        foundRows = oTempTable.Select(strFilter)

        For Each getRow In foundRows
            oTempTable.Rows.Remove(getRow)
        Next

        Mysecurity.AcceptChanges()

0
Comment
Question by:stephenz43
[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
4 Comments
 
LVL 10

Expert Comment

by:Kinger247
ID: 18015338
Ok, so when cust_security=0 its ok ?

Don't quite understand whats working and what isn't ?
0
 

Author Comment

by:stephenz43
ID: 18015364
when strFilter = Cust_security = 0...i get only records where cust_security = 0

what I want to accomplish is if cust_security = t_security as the filter....... doesnt want to work
0
 
LVL 34

Accepted Solution

by:
Sancler earned 1000 total points
ID: 18015707
In so far as I understand your sqlStatement (a) it looks like the filter should work but (b) so should xResult = 0.  That is because if cust_security = t_security then (cust_security-t_security) = 0.  So that might be an alternative to try.

If that fails as well then I think you want to stick in some debug code to test for the values in cust_security and t_security, as it looks like they might be other than expected.

Roger
0
 
LVL 39

Assisted Solution

by:appari
appari earned 1000 total points
ID: 18016233
are you getting some error or its returning 0 records?
if returning 0 records try the following filter,
Dim strFilter As String = "cust_security <> t_security"

check the count of records selected and see if it is same as base tables record count. if same means
cust_security and t_security are not equal for all the records.

in case you are getting error post the error message here
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

670 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