常用的C#带参数SQLite数据库,修改数据

        public bool Updata(Model.ProgrammeModel model)
        {
            bool b = false;
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update programme set ");
            strSql.Append("dy=@dy,");
            strSql.Append("dl=@dl,");
            strSql.Append("xx=@xx,");
            strSql.Append("glys=@glys,");
            strSql.Append("pl=@pl,");
            strSql.Append("xh=@xh,");
            strSql.Append("fa=@fa,");
            strSql.Append("pinli=@pinli,");
            strSql.Append("mdjx=@mdjx");

            strSql.Append(" where ID=@ID");
            SQLiteParameter[] parameters = {
                    new SQLiteParameter("@dy", model.dy),
                    new SQLiteParameter("@dl", model.dl),
                    new SQLiteParameter("@xx", model.xx),
                    new SQLiteParameter("@glys", model.glys),
                    new SQLiteParameter("@pl", model.pl),
                    new SQLiteParameter("@xh", model.xh),
                    new SQLiteParameter("@fa", model.fa),
                    new SQLiteParameter("@pinli", model.pinli),
                    new SQLiteParameter ("@mdjx",model.mdjx),
                    new SQLiteParameter("@ID", model.ID)};
            b = SQLiteHelper.ExecSQL(strSql.ToString(), parameters);
           //执行SQLite语句类库地址http://www.luofenming.com/show.aspx?id=ART2018020100001
            return b;
        }

评论