zoukankan      html  css  js  c++  java
  • SQLite

    delete from TableName   清空数据,不删除表
    参数化语句  ???
      public bool AddNoTask(PDAScanOperationRecords model)
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into PDAScanOperationRecords(");
                strSql.Append("ID,Flag,TaskID,MatID,MatCode,MatDesc,LocationCode,Location,Batch,BatchAmt,UomID,UomCode,Uom,PackUnitID,PackUnitCode,PackUnit,TransferPersonCode,TransferPerson,EquCode,EquDesc,EquLeaderCode,EquLeader,BilledUserCode,BiiledBy,ReturnPersonCode,ReturnPerson,InOutType,UserID ,UserCode,UserName,BussinessTypeId,BussinessType,WarehouseId,WarehouseCode ,WarehouseDesc,TeamCode,TeamDesc,CreatedOn)");
                strSql.Append(" values (");
                strSql.Append("'" + Guid.NewGuid().ToString() + "',2,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')");Code,@BiiledBy,@ReturnPersonCode,@ReturnPerson,@InOutType,@UserID,@UserCode,@UserName,@BussinessTypeId ,@BussinessType,@WarehouseId,@WarehouseCode,@WarehouseDesc,@TeamCode,@TeamDesc,'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')");
                SqlParameter[] parameters = {
         new SqlParameter("@TaskID", SqlDbType.Int,4),
         new SqlParameter("@MatID", SqlDbType.Int,4),
         new SqlParameter("@MatCode", SqlDbType.VarChar,200),
         new SqlParameter("@MatDesc", SqlDbType.VarChar,200),
         new SqlParameter("@LocationCode ",SqlDbType.VarChar,200),
         new SqlParameter("@Location", SqlDbType.VarChar,50),
         new SqlParameter("@Batch", SqlDbType.VarChar,200),
         new SqlParameter("@BatchAmt", SqlDbType.VarChar,200),
         new SqlParameter("@UomID", SqlDbType.Int,4),
         new SqlParameter("@UomCode", SqlDbType.VarChar,200),
         new SqlParameter("@Uom", SqlDbType.VarChar,200),
         new SqlParameter("@PackUnitID",SqlDbType.Int,4),
                                            new SqlParameter("@PackUnitCode", SqlDbType.VarChar,200),
         new SqlParameter("@PackUnit", SqlDbType.VarChar,200),
         new SqlParameter("@TransferPersonCode", SqlDbType.VarChar,200),
         new SqlParameter("@TransferPerson", SqlDbType.VarChar,200),
         new SqlParameter("@EquCode ",SqlDbType.VarChar,200),
         new SqlParameter("@EquDesc", SqlDbType.VarChar,200),
         new SqlParameter("@EquLeaderCode ", SqlDbType.VarChar,200),
         new SqlParameter("@EquLeader", SqlDbType.VarChar,200),
         new SqlParameter("@BilledUserCode", SqlDbType.VarChar,200),
         new SqlParameter("@BiiledBy", SqlDbType.Int,4),
         new SqlParameter("@ReturnPersonCode", SqlDbType.VarChar,200),
         new SqlParameter("@ReturnPerson",SqlDbType.VarChar,200),
                                            new SqlParameter("@InOutType", SqlDbType.Int,4),
         new SqlParameter("@UserID", SqlDbType.Int,4),
         new SqlParameter("@UserCode", SqlDbType.VarChar,200),
         new SqlParameter("@UserName", SqlDbType.VarChar,200),
         new SqlParameter("@BussinessTypeId ",SqlDbType.Int,4),
         new SqlParameter("@BussinessType", SqlDbType.VarChar,200),
         new SqlParameter("@WarehouseId ", SqlDbType.Int,4),
         new SqlParameter("@WarehouseCode", SqlDbType.VarChar,200),
         new SqlParameter("@WarehouseDesc", SqlDbType.VarChar,100),
         new SqlParameter("@TeamCode", SqlDbType.VarChar,200),
         new SqlParameter("@TeamDesc", SqlDbType.VarChar,200)};
                parameters[0].Value = model.TaskID;
                parameters[1].Value = model.MatID;
                parameters[2].Value = model.MatCode;
                parameters[3].Value = model.MatDesc;
                parameters[4].Value = model.LocationCode;
                parameters[5].Value = model.Location;
                parameters[6].Value = model.Batch;
                parameters[7].Value = model.BatchAmt;
                parameters[8].Value = model.UomID;
                parameters[9].Value = model.UomCode;
                parameters[10].Value = model.Uom;
                parameters[11].Value = model.PackUnitID;
                parameters[12].Value = model.PackUnitCode;
                parameters[13].Value = model.PackUnit;
                parameters[14].Value = model.TransferPersonCode;
                parameters[15].Value = model.TransferPerson;
                parameters[16].Value = model.EquCode;
                parameters[17].Value = model.EquDesc;
                parameters[18].Value = model.EquLeaderCode;
                parameters[19].Value = model.EquLeader;
                parameters[20].Value = model.BilledUserCode;
                parameters[21].Value = model.BiiledBy;
                parameters[22].Value = model.ReturnPersonCode;
                parameters[23].Value = model.ReturnPerson;
                parameters[24].Value = model.InOutType;
                parameters[25].Value = model.UserID;
                parameters[26].Value = model.UserCode;
                parameters[27].Value = model.UserName;
                parameters[28].Value = model.BussinessTypeId;
                parameters[29].Value = model.BussinessType;
                parameters[30].Value = model.WarehouseId;
                parameters[31].Value = model.WarehouseCode;
                parameters[32].Value = model.WarehouseDesc;
                parameters[33].Value = model.TeamCode;
                parameters[34].Value = model.TeamDesc;
                int intHistory = DataAccess.SqliteHelper.ExecuteNonQuery(strSql.ToString(), parameters);
                string strDelete = "delete from PDAScanOperationRecordsHistory where RowNumber < (select Max(RowNumber) from PDAScanOperationRecordsHistory) - 1000 ";
                int intDelete = DataAccess.SqliteHelper.ExecuteNonQuery(strDelete, null);
                if (intHistory > 0)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            }
     
    Hi, Tomorrow!
  • 相关阅读:
    szoj657 【AHSDFZNOI 7.2 WuHongxun】Odd
    cogs2652 秘术「天文密葬法」
    bzoj1026 [SCOI2009]windy数
    bzoj1862/1056: [Zjoi2006]GameZ游戏排名系统
    java-PreparedStatement的用法
    java-JDBC登录注册代码
    java-String Date Calendar之间的转换
    java-如何用eclipse打包jar
    java-通过JDBC操作数据库
    java-JDBC配置驱动程序
  • 原文地址:https://www.cnblogs.com/aikeming/p/11985784.html
Copyright © 2011-2022 走看看