NOT IN statement for Visual Studio's Query Builder for TableAdapter
- by Fabiano
Hi
I want to realize a query with the Visual Studio 2008 build in Query Builder for a TableAdapter similar like following (MSSQL 2008):
select * from [MyDB].[dbo].[MyView] where UNIQUE_ID NOT IN ('MyUniqueID1','MyUniqueID2')
How do I have to set the Filter in my query in order to call it with the myTableAdapter.GetDataExceptUniqueIds(...) function?
I tried to set the filter to NOT IN (@ids) and called it with
string[] uniqueIds = ...;
myTableAdapter.GetDataExceptUniqueIds(String.Join("','", uniqueIds));
and with
StringBuilder sb = new StringBuilder("'");
sb.Append(String.Join("','", uniqueIds));
sb.Append("'");
return myTableAdapter.GetDataExceptUniqueIds(sb.ToString());
but both failed