必须声明标量变量@id的问题

研究了一下午,语句为什么执行不了
因为我执行了sql语句而没有存变量
代码如下:
StringBuilder sb = new StringBuilder();
List listParams = new List();

上面是分别存放sql和变量的对象

sb.AppendLine(” where Country = @country “);
listParams.Add(new SqlParameter(“@country”, country));

country的值是传进来的

DataTable result = db.ExecuteQuery(sb.ToString(), listParams.ToArray());

最后执行的时候务必要写后面的listParams

你可能感兴趣的:(必须声明标量变量@id的问题)