private void cboEmpresa_SelectionChangeCommitted(object sender, EventArgs e) { DataRow dr = ((DataRowView)cboEmpresa.SelectedValue).Row; Variables.strCon = fun.TryStr(dr["ConStr"]); strCn = Variables.strCon; cnn = new afgCon(strCn); }
private void Login_Load(object sender, EventArgs e) { cboEmpresa.DisplayMember = "nomEmpresa"; cboEmpresa.ValueMember = "nomEmpresa"; dtCnx = fun.GetXml("Empresas", "Empresa", "nomEmpresa,ConStr"); cboEmpresa.DataSource = new DataView(dtCnx); Variables.nomEmpresa = fun.TryStr(dtCnx.Rows[0]["nomEmpresa"]); cboEmpresa.SelectedValue = dtCnx.Rows[0]["nomEmpresa"]; Variables.strCon = (string)dtCnx.Rows[0]["ConStr"]; strCn = Variables.strCon; cnn = new afgCon(strCn); }
public static string getMaxString(string nomTable, string column, string filter = ";") { DataTable dt = new DataTable(); int max = 0, num = 0; afgCon cn = new afgCon(Variables.strCon); cn.Open(); string cmd = "SELECT " + column + " FROM " + nomTable + " " + filter; cn.dtFill(dt, cmd); foreach (DataRow dr in dt.Rows) { num = TryInt(dr[column]); if (num > max) { max = num; } } max++; return(max.ToString()); }
private void MainForm_Load(object sender, EventArgs e) { cnn = new afgCon(c); nameCurrentClass = Name; }