Click here to Skip to main content
15,919,749 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I am getting Error while i am forming the statement.

Mycolname = "WIN TAG";

sqlcmd =  ( Stundetno = '101')  and ( WIN TAG = 'A1' )

DataRow[] result = dt.Select(sqlcmd); // Error : Syntax error: Missing operand after 'TAG' operator.

what is the Error...?


What I have tried:

qlcmd =  ( Stundetno = '101')  and ( WIN TAG = 'A1' )

DataRow[] result = dt.Select(sqlcmd);
Posted
Updated 11-Oct-17 23:54pm
Comments
Karthik_Mahalingam 12-Oct-17 5:33am    
what is this
sqlcmd =  ( Stundetno = '101')  and ( WIN TAG = 'A1' )
Maciej Los 12-Oct-17 10:38am    
This is a part of select statement of datatable.
Karthik_Mahalingam 12-Oct-17 10:41am    
got confused with the variable name and also the syntax :)

1 solution

Spaces aren't allowed in SQL names unless they are enclosed.
Try this:
C#
sqlcmd =  "( Stundetno = '101')  and ( [WIN TAG] = 'A1' )";
 
Share this answer
 

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