using MESClassLibrary.EFModel; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Text; namespace MESClassLibrary.DAL.Log { public class LogDelDAL { public static string TableName = "tb_DelData_Log"; public string GetTableName() { return TableName; } public static bool Add_Info(tb_DelData_Log mod) { try { #region 添加数据 string sql = ""; SqlParameter[] param = null; sql = "INSERT INTO " + TableName + " (ID,TableName,KeyId,UserID,CreateTime"; sql += ") VALUES ("; sql += "@ID,"; sql += "@TableName,"; sql += "@KeyId,"; sql += "@UserID,"; sql += "@CreateTime)"; #region 添加参数 param = new SqlParameter[5]; param[0] = new SqlParameter("@ID", SqlDbType.VarChar); param[0].Value = mod.ID; param[1] = new SqlParameter("@TableName", SqlDbType.VarChar); param[1].Value = mod.TableName; param[2] = new SqlParameter("@KeyId", SqlDbType.VarChar); param[2].Value = mod.KeyId; param[3] = new SqlParameter("@UserID", SqlDbType.VarChar); param[3].Value = mod.UserID; param[4] = new SqlParameter("@CreateTime", SqlDbType.DateTime); param[4].Value = mod.CreateTime; #endregion SqlHelper.ExecuteNonQuery(SqlHelper.GetConnSting(), CommandType.Text, sql, param); #endregion return true; } catch (Exception ex) { return false; } } } }