J
Jeff
Hi -
For my VB.NET app, I have a SQL2K database that I use to create a dataset
with multiple data tables. I've created a dataview (dvReportsTo) of one of
the tables, SCPMaster, and I've bound a combobox control to that dataview.
I'm trying to filter the dataview based on values in a second table
(ReportsTo) in the same dataset, and it's not working.
If it's possible to do this, please help me figure out what I've done wrong
and how to implement this correctly. If I'm trying to do something that is
not supported, I'd appreciate any suggestions of a workaround.
Here's the filter I'm trying to implement:
strFilter = "SCPMasterID <> '" & uidSelectedPerson.ToString & "'"
strFilter &= " AND SCPMasterID NOT IN"
strFilter &= " (SELECT ReportsToStaffID FROM ReportsTo"
strFilter &= " WHERE ReportsToBossID = '" & uidSelectedPerson.ToString &
"')"
frmMain.dvReportsTo.RowFilter = strFilter
Here's the DataException that I'm getting:
System.Data.SyntaxErrorException: Syntax error: Missing operand after
'ReportsToStaffID' operator.
at System.Data.ExpressionParser.Parse()
at System.Data.DataExpression..ctor(String expression, DataTable table,
Type type)
at System.Data.DataExpression..ctor(String expression, DataTable table)
at System.Data.DataFilter..ctor(String expression, DataTable table)
at System.Data.DataView.set_RowFilter(String value)
at StarContactPro_02_DT.modContact.SetReportsToFilter() in d:\Data\Visual
Studio Projects\StarContactPro-02-DT\modContact.vb:line 107"
Thanks for your help.
- Jeff
For my VB.NET app, I have a SQL2K database that I use to create a dataset
with multiple data tables. I've created a dataview (dvReportsTo) of one of
the tables, SCPMaster, and I've bound a combobox control to that dataview.
I'm trying to filter the dataview based on values in a second table
(ReportsTo) in the same dataset, and it's not working.
If it's possible to do this, please help me figure out what I've done wrong
and how to implement this correctly. If I'm trying to do something that is
not supported, I'd appreciate any suggestions of a workaround.
Here's the filter I'm trying to implement:
strFilter = "SCPMasterID <> '" & uidSelectedPerson.ToString & "'"
strFilter &= " AND SCPMasterID NOT IN"
strFilter &= " (SELECT ReportsToStaffID FROM ReportsTo"
strFilter &= " WHERE ReportsToBossID = '" & uidSelectedPerson.ToString &
"')"
frmMain.dvReportsTo.RowFilter = strFilter
Here's the DataException that I'm getting:
System.Data.SyntaxErrorException: Syntax error: Missing operand after
'ReportsToStaffID' operator.
at System.Data.ExpressionParser.Parse()
at System.Data.DataExpression..ctor(String expression, DataTable table,
Type type)
at System.Data.DataExpression..ctor(String expression, DataTable table)
at System.Data.DataFilter..ctor(String expression, DataTable table)
at System.Data.DataView.set_RowFilter(String value)
at StarContactPro_02_DT.modContact.SetReportsToFilter() in d:\Data\Visual
Studio Projects\StarContactPro-02-DT\modContact.vb:line 107"
Thanks for your help.
- Jeff