Solved

dataset problem

Posted on 2006-11-26
4
240 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
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 250 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 250 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expando 4 46
Javascript Refresh Parent Page from Popup 3 48
Iterate a dictionnary to change values 4 53
Receiving a string from a WebService Push 21 32
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

914 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

21 Experts available now in Live!

Get 1:1 Help Now