NOT IN statement for Visual Studio's Query Builder for TableAdapter
Posted
by Fabiano
on Stack Overflow
See other posts from Stack Overflow
or by Fabiano
Published on 2010-05-20T12:05:29Z
Indexed on
2010/05/20
19:20 UTC
Read the original article
Hit count: 448
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
© Stack Overflow or respective owner