private void btnDelete_Click(object sender, EventArgs e) { if (this.dataGridView1.SelectedRows.Count > 0) { //遍历选中行 foreach (DataGridViewRow row in this.dataGridView1.SelectedRows) { if (!row.IsNewRow) { string sql = "DELETE FROM 井眼轨迹表 WHERE 序号=" + row.Cells[0].Value; Console.WriteLine(sql); var res = mysqlDB.Edit(sql); if (res) { MessageBox.Show("删除成功"); } else { MessageBox.Show("删除失败"); } this.dataGridView1.Rows.Remove(row); } } } else { MessageBox.Show("请选择行!"); } }
private void btnSubmit_Click(object sender, EventArgs e) { MysqlDB mysqlDB; mysqlDB = new MysqlDB("49.235.232.46", 3306, "cement", "123456"); string type = null; try { string sql = "insert into user(用户账号,用户昵称,用户密码,用户真实姓名,用户联系方式,用户地址,用户注册时间) values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + DateTime.Now + "')"; Console.WriteLine(sql); var res = mysqlDB.Edit(sql); if (res) { MessageBox.Show("添加成功"); this.Close(); } else { MessageBox.Show("添加失败"); } } catch (System.FormatException) { MessageBox.Show("输入格式错误"); } }
private void btnSubmit_Click(object sender, EventArgs e) { MysqlDB mysqlDB; mysqlDB = new MysqlDB("49.235.232.46", 3306, "cement", "123456"); try { string sql = "INSERT well(井号,地点,负责人姓名,负责人电话,负责人地址,开井时间)" + " VALUE('" + JingHao.Text + "','" + where.Text + "','" + name.Text + "','" + phone.Text + "','" + addres.Text + "','" + time.Value + "')"; Console.WriteLine(sql); var res = mysqlDB.Edit(sql); if (res) { MessageBox.Show("添加成功"); this.Close(); } else { MessageBox.Show("添加失败"); } } catch (System.FormatException) { MessageBox.Show("输入格式错误"); } }
private void btnSubmit_Click(object sender, EventArgs e) { try { string sql = "INSERT 钻井液沿裂缝压力穿透效应及钻井液有效封堵性对井壁稳定性表" + "(井号,深度,井壁径向渗流能力,井壁径向与层理面法向夹角,井筒_地层渗流场及孔)" + " VALUE('" + JingHao.Text + "'," + (float)Convert.ToSingle(textHeight.Text) + "," + (float)Convert.ToSingle(textShenLiu.Text) + "," + (float)Convert.ToSingle(textJiaJiao.Text) + "," + (float)Convert.ToSingle(textKong.Text) + ")"; Console.WriteLine(sql); var res = mysqlDB.Edit(sql); if (res) { MessageBox.Show("添加成功"); this.Close(); } else { MessageBox.Show("添加失败"); } } catch (System.FormatException) { MessageBox.Show("输入格式错误"); } }
private void btnSubmit_Click(object sender, EventArgs e) { string type = null; if (Zheng.Checked) { type = "潜在正断层类"; } if (ZouHua.Checked) { type = "潜在走滑断层类"; } if (NiChong.Checked) { type = "潜在逆冲断层类"; } try { string sql = "INSERT 地应力大小表(井号,地应力类型,地应力X大小,地应力Y大小,地应力Z大小,深度,记录时间)" + " VALUE('" + JingHao.Text + "'," + "'" + type + "'," + (float)Convert.ToSingle(textX.Text) + "," + (float)Convert.ToSingle(textY.Text) + "," + (float)Convert.ToSingle(textZ.Text) + "," + (float)Convert.ToSingle(textHeight.Text) + "," + "'" + DateTime.Now + "'" + ")"; Console.WriteLine(sql); var res = mysqlDB.Edit(sql); if (res) { MessageBox.Show("添加成功"); this.Close(); } else { MessageBox.Show("添加失败"); } } catch (System.FormatException) { MessageBox.Show("输入格式错误"); } }
private void btnSubmit_Click(object sender, EventArgs e) { if (zhanghao.Text != "" & nicheng.Text != "" & mima.Text != "" & xingming.Text != "" & lianxi.Text != "" & dizhi.Text != "" & dateTimePicker1.Value != null) { MysqlDB mysqlDB; mysqlDB = new MysqlDB("49.235.232.46", 3306, "cement", "123456"); try { //string sql1 = "insert into power values (" + "'" + zhanghao.Text + "'" + "," + "'" + xingming.Text + "'" + "," + "'" + "管理员" + "'" + "," + "'" +DateTime.Today+ "'" +","+ "'"+"修改人"+"'"+")"; string sql = "insert into management values (" + "'" + zhanghao.Text + "'" + "," + "'" + nicheng.Text + "'" + "," + "'" + mima.Text + "'" + "," + "'" + xingming.Text + "'" + "," + "'" + lianxi.Text + "'" + "," + "'" + dizhi.Text + "'" + "," + "'" + DateTime.Today + "'" + "," + "'" + dateTimePicker1.Value.ToString() + "'" + ")"; Console.WriteLine(sql); //Console.WriteLine(sql1); var res = mysqlDB.Edit(sql); //var res1 = mysqlDB.Edit(sql1); if (res) { MessageBox.Show("添加成功"); this.Close(); } else { MessageBox.Show("添加失败"); } /* if (res1) * { * MessageBox.Show("权限表更新成功"); * this.Close(); * } * else * { * MessageBox.Show("权限表更新失败"); * }*/ } catch (System.FormatException) { MessageBox.Show("输入格式错误"); } } else { MessageBox.Show("请将输入信息填写完整"); } }
private void btnSubmit_Click(object sender, EventArgs e) { MysqlDB mysqlDB; mysqlDB = new MysqlDB("49.235.232.46", 3306, "cement", "123456"); try { string sql = "INSERT 井眼轨迹表" + "(井号,深度,井斜角,方位角,地层坍塌压力当量密度,时间)" + " VALUE('" + JingHao.Text + "'," + (float)Convert.ToSingle(textHeight.Text) + "," + (float)Convert.ToSingle(textJinxie.Text) + "," + (float)Convert.ToSingle(textFangwei.Text) + "," + (float)Convert.ToSingle(textMidu.Text) + ",'" + DateTime.Now + "')"; Console.WriteLine(sql); var res = mysqlDB.Edit(sql); if (res) { MessageBox.Show("添加成功"); this.Close(); f1.dataGridView1_refresh(); } else { MessageBox.Show("添加失败"); } } catch (System.FormatException) { MessageBox.Show("输入格式错误"); } }
private void btnSubmit_Click(object sender, EventArgs e) { MysqlDB mysqlDB; mysqlDB = new MysqlDB("49.235.232.46", 3306, "cement", "123456"); int i = 1; try { string sql = "INSERT into shuihua(井号,深度,黏土矿物类型,含量分布,水化作用强度,时间)" + " VALUE('" + JingHao.Text + "'" + ',' + "'" + textX.Text + "'" + "," + "'" + textY.Text + "'" + "," + "'" + textZ.Text + "'" + "," + "'" + textH.Text + "'" + "," + "'" + DateTime.Now + "'" + ")"; Console.WriteLine(sql); var res = mysqlDB.Edit(sql); if (res) { MessageBox.Show("添加成功"); this.Close(); } else { MessageBox.Show("添加失败"); } } catch (System.FormatException) { MessageBox.Show("输入格式错误"); } }
private void button1_Click(object sender, EventArgs e) { var regex3 = new Regex(@" (?=.*^[0-9]*$) #必须包含数字 .{6,20} #至少8个字符,最多30个字符 ", RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace); //校验密码是否符合 bool pwdIsMatch3 = regex3.IsMatch(textBox1.Text); var regex1 = new Regex(@" (?=.*[0-9]) #必须包含数字 (?=.*[a-zA-Z]) (?=([\x21-\x7e]+)[^a-zA-Z0-9]) #必须包含特殊符号#必须包含小写或大写字母 .{6,20} #至少8个字符,最多30个字符 ", RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace); //校验密码是否符合 bool pwdIsMatch1 = regex1.IsMatch(textBox3.Text); var regex2 = new Regex(@" (?=.*[0-9]) #必须包含数字 (?=.*[a-zA-Z]) (?=([\x21-\x7e]+)[^a-zA-Z0-9]) #必须包含特殊符号#必须包含小写或大写字母 .{6,20} #至少8个字符,最多30个字符 ", RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace); //校验密码是否符合 bool pwdIsMatch2 = regex2.IsMatch(textBox7.Text); var regex4 = new Regex(@" (?=.*^[0-9]*$) #必须包含数字 .{11,11} #至少8个字符,最多30个字符 ", RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace); //校验密码是否符合 bool pwdIsMatch4 = regex4.IsMatch(textBox5.Text); //////////////////////////////////////////////// if (pwdIsMatch3 == true) { if (pwdIsMatch1 == true && pwdIsMatch2 == true) { if (textBox3.Text.Trim().Equals(textBox7.Text.Trim())) { if (pwdIsMatch4 == true) { MysqlDB mysqlDB; mysqlDB = new MysqlDB("49.235.232.46", 3306, "cement", "123456"); string type = null; try { string sql = "insert into user(用户账号,用户昵称,用户密码,用户真实姓名,用户联系方式,用户地址,用户注册时间) values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + DateTime.Now + "')"; Console.WriteLine(sql); var res = mysqlDB.Edit(sql); if (res) { MessageBox.Show("添加成功"); /*string po = "四级"; * string na = "管理员"; * string sql3 = "insert into power(账号,姓名,权限级别,修改时间,修改人) values('" + textBox1.Text + "','" + textBox4.Text + "','" + po + "','" + DateTime.Now + "','" + na + "')"; * Console.WriteLine(sql3); * var res2 = mysqlDB.Edit(sql3); * if (res2) * { } * else * { * MessageBox.Show("权限申请失败"); * }*/ this.Close(); } else { MessageBox.Show("添加失败"); } } catch (System.FormatException) { MessageBox.Show("输入格式错误"); } } else { MessageBox.Show("必须电话号码是11位纯数字的号码"); } } else { MessageBox.Show("两次输入密码不一致,请重新输入"); } } else { MessageBox.Show("密码格式不对请输入字母加数字组合的6-20位"); } } else { MessageBox.Show("账号格式不对请输入纯数字6-20位"); } }