Click here to Skip to main content
16,022,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI,

i want to use below quey in the vb.net code

query:
select count(*)As count,TLA_ITEM_NUMBER, MODEL_NUMBER from ace_cfg_blackbox where  CFG_ORDER_ID ='9052' and  CFG_PSI_ID IN ('17208') AND ENCLOSURE_ID > 1 AND SYSTEM_ID = 1 Group by TLA_ITEM_NUMBER, MODEL_NUMBER--And rownum <=1



Vb.Net Code
m_blackBoxTable.Select("count(" + "*)As Count" + ", TLA_ITEM_NUMBER, MODEL_NUMBER " + "CFG_ORDER_ID =" + orderRow.Item("CFG_ORDER_ID").ToString + " AND CFG_PSI_ID IN (" + lstrReleasedPsi.ToString + ") AND ENCLOSURE_ID > 1 AND SYSTEM_ID = " + systemRow.Item("SYSTEM_ID").ToString + "Group by TLA_ITEM_NUMBER, MODEL_NUMBER")


but its giving runtime exception as below

Run-time exception thrown : System.Data.SyntaxErrorException - Syntax error in aggregate argument: Expecting a single column argument with possible 'Child' qualifier.


pls help me out from this.

if there is any syntax error in the above code,pls let me know.

Thanks in Advance.
subhash G.
Posted

1 solution

You cannot write entire sql statment in filter string.

syntax for dataTable.Select(string filterexpression)

filterexpression will containt only the part on where clause
It can also containt a sort order as second parameter.


http://msdn.microsoft.com/en-us/library/det4aw50.aspx[^]


What you are trying can be achieved using LINQ
 
Share this answer
 
v2
Comments
subhash04573 21-Sep-11 3:52am    
then what about count ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900