public ChenBenJinCangMake() { InitializeComponent(); this.Location = new Point(0, 0); db = SqlBase.GetInstance(); init(); }
/// <summary> /// execute the procedure with params /// </summary> /// <param name="con"></param> /// <param name="sqlString">procedure name or sql expression</param> /// <param name="param">params array</param> /// <param name="type" >execute style</param> public static int ExecuteQuery(string sqlString, SqlParameter[] param, CommandType type) { if (sqlString == null || sqlString == "") { throw new Exception(nullSqlExpress); } using (SqlConnection con = SqlBase.GetConnection()) { try { con.Open(); } catch { throw new Exception(Sql_Connection_Err); } SqlCommand command = con.CreateCommand(); command.CommandText = sqlString; command.CommandType = type; foreach (SqlParameter p in param) { command.Parameters.Add(p); } return((int)command.ExecuteNonQuery()); } }
public IActionResult DBScript() { //type source name uname passwd M_APIResult retMod = new M_APIResult(Failed); try { string connStr = GetConnstr(); DBCenter.DB = SqlBase.CreateHelper("mssql"); DBCenter.DB.ConnectionString = SiteConfig.SiteInfo.ConnectionString = connStr; if (!DataConvert.CBool(GetParam("ignoreSql"))) { string sqlPath = function.VToP("/App_Data/Data.sql"); DBHelper.ExecuteSqlScript(GetConnstr(), sqlPath); } SiteConfig.Update(); retMod.retcode = M_APIResult.Success; } catch (Exception ex) { retMod.retmsg = ex.Message; ZLLog.L("安装时出错,原因:" + ex.Message); } return(Content(retMod.ToString())); }
public static void CreateNew(string name, string password) { SqlBase.Instance("LogonSettings").Execute( string.Format( "INSERT INTO `accounts` (`login`, `password`, `banned`, `flags`) VALUES ('{0}', '{1}', '0', '44')", name, password)); }
//protected bool PreventSqlInjection; protected IQuery(SqlBase SQLH, string TableName) { this.SQLH = SQLH; this.Parameters = new Dictionary <string, object>(); this.TableName = TableName; //this.PreventSqlInjection = false; }
public MaDanMake() { InitializeComponent(); this.Location = new Point(0, 0); db = SqlBase.GetInstance(); init(); }
public string LabelSql_API() { M_APIResult retMod = new M_APIResult(M_APIResult.Success); string action = Request.Query["action"]; try { switch (action) { case "tables": //根据数据库获取表信息 { } break; case "fields": //根据当前选中的表,获取字段信息 { string dsname = RequestEx["dsname"]; string tbname = RequestEx["tbname"]; SqlBase db = B_DataSource.GetDSByType(dsname); DataTable dt = db.Field_List(tbname); dt.DefaultView.Sort = "Name"; retMod.result = JsonConvert.SerializeObject(dt); } break; } } catch (Exception ex) { retMod.retmsg = ex.Message; retMod.retcode = M_APIResult.Failed; } return(retMod.ToString()); }
public ColorName() { InitializeComponent(); this.TopLevel = false; this.Location = new Point(0, 0); db = SqlBase.GetInstance(); lblwait = new LblWait((Form)this); groupPanel1.ResumeLayout(false); groupPanel1.PerformLayout(); Rectangle ScreenArea = Screen.GetWorkingArea(this); dgvEX1.BackgroundColor = SystemColors.Window; dgvEX1.AutoGenerateColumns = false; dgvEX1.AllowUserToAddRows = false; dgvEX1.AllowUserToDeleteRows = false; dgvEX1.AllowUserToResizeRows = false; dgvEX1.AllowUserToAddRows = false; //删除最后一条空白 dgvEX1.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing; //行高不可变 dgvEX1.RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode.DisableResizing; dgvEX1.MultiSelect = false; dgvEX1.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvEX1.EditMode = DataGridViewEditMode.EditProgrammatically; var getAll = db.Queryable <T_Base>() .Where(it => it.leibie == YanSe) .ToList(); ShowData(getAll); }
public frmCL() { InitializeComponent(); db = SqlBase.GetInstance(); timerShowTime.Enabled = true; timerShowTime.Interval = 1000; timerShowTime.Tick += new EventHandler(this.timerShowTime_Tick); lblGS.Text = UserProc.GSname + " 配方与称料控制系统"; lblBB.Text = "ver:" + UserProc.StrVer; if (Settings.Default.paraKeyB == 18) { lblBtnSch.Text = "查询料单(F1)"; lblBtnMC.Text = "免称扣除(F2)"; } else { lblBtnSch.Text = "查询料单( • )"; lblBtnMC.Text = "免称扣除(上翻)"; } this.dgvData.Dock = DockStyle.Fill; this.txtJH.txt.TextAlign = HorizontalAlignment.Center; this.txtSL.txt.TextAlign = HorizontalAlignment.Center; this.txtZL.txt.TextAlign = HorizontalAlignment.Center; this.txtJH.txt.ForeColor = Color.DarkRed; this.txtSL.txt.ForeColor = Color.DarkRed; this.txtZL.txt.ForeColor = Color.DarkRed; this.lblDate.Text = ""; this.lblKeyS.Text = ""; this.lblTPerr.Text = ""; }
/// <summary> /// use datareader to get the data from database /// </summary> /// <param name="con">database connection object</param> /// <param name="sql">procedure name or sql expression</param> /// <returns>DataReader object</returns> public static SqlDataReader ExecuteDataReader(string sql, CommandType type) { if (sql == null || sql == "") { throw new Exception(nullSqlExpress); } SqlConnection con = SqlBase.GetConnection(); try { con.Open(); } catch { throw new Exception(Sql_Connection_Err); } SqlCommand command = con.CreateCommand(); command.CommandText = sql; command.CommandType = type; SqlDataReader read = command.ExecuteReader(CommandBehavior.CloseConnection); return(read); }
public void MarkAsSynced(SqlBase origin) { try { SyncHistory syncHistory = new SyncHistory { DeviceId = Daemon.Devices.Device.Current.DeviceId, Guid = this.Guid, Date = DateTime.Now }; origin.Table <SyncHistory>().Delete(x => x.Guid == syncHistory.Guid); origin.Insert(syncHistory, string.Empty); //if (connection is SqlServer SQLH) //{ // SQLH.EXEC("INSERT INTO DESCARGAS_VERSIONES(ID_DESCARGA,ID_DISPOSITIVO) VALUES(@ID_DESCARGA,@ID_DISPOSITIVO)" // , System.Data.CommandType.Text, false, // new SqlParameter("ID_DESCARGA", Id), // new SqlParameter("ID_DISPOSITIVO", Device.Current.DeviceId)); //} //else if (connection is SqLite SQLHLite) //{ // SQLHLite.EXEC($"DELETE FROM VERSION_CONTROL WHERE ID=?", Id); //} } catch (Exception ex) { Log.Logger.Error(ex, "Al marcar como finalizada la sincronización - [{0}]", this); } }
public static DataTable ExecuteDataTable(string sql, SqlParameter[] param, CommandType type) { if (sql == null || sql == "") { throw new Exception(nullSqlExpress); } using (SqlConnection con = SqlBase.GetConnection()) { try { con.Open(); } catch { throw new Exception(Sql_Connection_Err); } SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = new SqlCommand(); da.SelectCommand.Connection = con; da.SelectCommand.CommandText = sql; da.SelectCommand.CommandType = type; foreach (SqlParameter p in param) { da.SelectCommand.Parameters.Add(p); } DataTable dt = new DataTable(); da.Fill(dt); return(dt); } }
public FrmRHLCB() { InitializeComponent(); bsSch = new BindingSource(); lblwait = new LblWait(this); db = SqlBase.GetInstance(); }
/// <summary> /// get the data with dataset object /// </summary> /// <param name="sql">procedure name or sql expression</param> /// <returns>DataSet</returns> public static DataSet ExecuteDataSet(string sql, CommandType type) { if (sql == null || sql == "") { throw new Exception(nullSqlExpress); } using (SqlConnection con = SqlBase.GetConnection()) { try { con.Open(); } catch { throw new Exception(Sql_Connection_Err); } SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = new SqlCommand(); da.SelectCommand.CommandType = type; da.SelectCommand.CommandText = sql; da.SelectCommand.Connection = con; DataSet ds = new DataSet(); da.Fill(ds); return(ds); } }
public ShenChanLc() { InitializeComponent(); MaximizeBox = false; this.TopLevel = false; this.Location = new Point(0, 0); dgvEX1Init(); dgvEX2Init(); Rectangle ScreenArea = Screen.GetWorkingArea(this); var width = (ScreenArea.Width) / Width; db = SqlBase.GetInstance(); var getAll = db.Queryable <BaseList>() .Where(it => it.leibie == "流程") .Distinct() .Select(it => new { it.itemkey }) .OrderBy(it => it.itemkey) .ToList(); Console.WriteLine("当前行数" + getAll.Count); dgvEX1.Rows.Clear(); for (var i = 0; i < getAll.Count; i++) { var dataRowCollection = getAll[i]; int index = dgvEX1.Rows.Add(); dgvEX1.Rows[index].Cells[0].Value = dataRowCollection.itemkey; } }
public Base() { InitializeComponent(); this.TopLevel = false; this.Location = new Point(0, 0); db = SqlBase.GetInstance(); }
public DataSet GetChiFengDate(string BH, string jydbh, string jydbhTo = "") { SqlBase sqlbase = new SqlBase(ESqlConnType.ConnectionStringCF); string where = "where 1=1"; int top = 100; if (!string.IsNullOrEmpty(jydbh)) { where = $" where JYDBH={jydbh}"; } if (!string.IsNullOrEmpty(jydbh) && !string.IsNullOrEmpty(jydbhTo)) { where = $" where JYDBH>={jydbh}"; top = 9999; } if (!string.IsNullOrEmpty(jydbhTo)) { where += $" and JYDBH<={jydbhTo}"; } string sqlStr = $"select top {top} * from M{BH} {where} and BGBH <>'' order by RECID DESC"; DataSet mdata = sqlbase.ExecuteDataset(sqlStr); return(mdata); }
public void GetWhereTest() { var actual1 = SqlBase.GetWhere(""); var actual2 = SqlBase.GetWhere("ID>10"); Assert.AreEqual("", actual1); Assert.AreEqual(" WHERE ID>10", actual2); }
public override bool CustomUpload(SqlBase con, SqlBase targetcon, TableMapping map) { if (targetcon is not SQLServerConnection) { return(true); } return(Execute().GetAwaiter().GetResult().ToResponse().ResponseResult == APIResponseResult.OK); }
internal DaemonConfig(int DbVersion, SqlBase Local, SqlBase Remote, int MaxSleep = 30, bool showErrorDialog = false) { this.DbVersion = DbVersion; this.Local = Local; this.Remote = Remote; this.MaxSleep = MaxSleep; this.ShowErrorDialog = showErrorDialog; }
public ChanLiangDjMake() { InitializeComponent(); this.Location = new Point(0, 0); db = SqlBase.GetInstance(); lblPIH.txt.Text = "100%"; lblPIH.txt.Leave += Txt_Leave; }
public FrmLogin(bool _islock) { this.EnableGlass = false; this.InitializeComponent(); //this.lblGS.Text = UserProc.GSname; this.islock = _islock; db = SqlBase.GetInstance(); }
public FanXiuDjCha() { InitializeComponent(); lblwait = new LblWait(this); TopLevel = false; Location = new Point(0, 0); db = SqlBase.GetInstance(); }
public FanXiuDjMake() { InitializeComponent(); this.Location = new Point(0, 0); db = SqlBase.GetInstance(); lblPIH.txt.Leave += Txt_Leave; //EableInput(false); Empty(); }
public Search() { InitializeComponent(); this.TopLevel = false; this.Location = new Point(0, 0); db = SqlBase.GetInstance(); lblwait = new LblWait((Form)this); Column3.Tag = (object)"行:"; }
public FrmRLRK1() { InitializeComponent(); db = SqlBase.GetInstance(); this.lblwait = new LblWait((Form)this); EditMode = false; SearchMode = false; RL(); }
public override void SetDbName(string dbname) { SqlBase sqlBase = new SqlBase(); sqlBase.SetDb(dbname); sqlConnection1.ConnectionString = sqlBase.ConnectionString; sqlConnection2.ConnectionString = sqlBase.ConnectionString; _table.Columns["Record_ID"].AutoIncrementSeed = GetLastId() + 1; }
public static DeviceInformation Get(SqlBase sql) { return(sql.Table <DeviceInformation>() .FirstOrDefault(x => x.DeviceId == Device.Current.DeviceId) ?? new DeviceInformation() { DeviceId = Device.Current.DeviceId }.SetIsFirstLaunchTime(true).Save(sql)); }
public FrmDLJL() { InitializeComponent(); db = SqlBase.GetInstance(); this.lblwait = new LblWait((Form)this); this.bsSch = new BindingSource(); mainColRL.Tag = "总行:"; Search(); }
public FrmUser(Bar bar) { InitializeComponent(); this.TopLevel = false; db = SqlBase.GetInstance(); Bottom_Group.Visible = false; this._bar = bar; lblwait = new LblWait((Form)this); }
protected void Page_Load(object sender, EventArgs e) { ISql t_Sql = new SqlBase(); }