研究了一下午,语句为什么执行不了
因为我执行了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