I am trying to use the parameterized query to get a data set in a OLE DB data adapter. But I always get the following error when it is executed:
[SQL Parser] [Line 1] Syntax error near '@'
The following is the simplified code:
using (OleDbCommand cmd = new OleDbCommand())
cmd.Connection = connectionObject;
cmd.CommandText = "SELECT tag FROM PIPOINT..PIPOINT2 WHERE tag LIKE @TagName";
OleDbParameter param = new OleDbParameter("@TagName", OleDbType.VarChar);
param.Value = "SINUSOID";
What’s wrong with this code?