private void cancelButton_Click(object sender, EventArgs e) { if (flag == "0") { changeImfor chanInfo = new changeImfor(); chanInfo.Show(); this.Hide(); } else { Form3 form3 = new Form3(); form3.Show(); this.Hide(); } }
private void jiaoYiJiLu_FormClosing(object sender, FormClosingEventArgs e) { Form3 form3 = new Form3(); form3.Show(); this.Hide(); }
private void confirmButton_Click(object sender, EventArgs e) { string introduce = "", name = "", priceString = "", picLink = "",uname = ""; string time; time = DateTime.Now.ToString("yyyyMMdd"); float price; if(nameText.Text == "") { MessageBox.Show("对不起,您的宝贝没有名称!"); return; } name = nameText.Text; if(introText.Text == "") { MessageBox.Show("对不起,请为您的宝贝介绍一下!"); return; } introduce = introText.Text; if(priceText.Text == "") { MessageBox.Show("对不起,请为您的宝贝添加价格!"); return; } priceString = priceText.Text; if(picText.Text == "") { MessageBox.Show("对不起,请问您的宝贝添加图片"); return; } picLink = picText.Text; string con, sql1 = "",sql2 = ""; price = Convert.ToSingle(priceString); con = "Server=.;Database=keshe;user id = sa;password = 316023"; sql1 = "select * from stayUser"; SqlConnection myCon = new SqlConnection(con); myCon.Open(); SqlCommand myCom = new SqlCommand(sql1, myCon); SqlDataReader myReader = myCom.ExecuteReader(); while (myReader.Read()) { uname = myReader.GetString(0); } myCon.Close(); myCon.Open(); if(flag == "0") { sql2 = string.Format("delete from thing where Tpic = '{0}';insert into thing values('{1}','{2}','{3}','{4}','{5}',{6})",link, uname, name, introduce, picLink, time, price); MessageBox.Show("修改成功!"); } else { sql2 = string.Format("insert into thing values('{0}','{1}','{2}','{3}','{4}',{5})", uname, name, introduce, picLink, time, price); MessageBox.Show("添加成功!"); } SqlCommand myCom1 = new SqlCommand(sql2, myCon); myCom1.ExecuteNonQuery(); myCon.Close(); Form3 form3 = new Form3(); form3.Show(); this.Hide(); }
private void Form5_FormClosing(object sender, FormClosingEventArgs e) { if(flag == "0") { changeImfor chanInfo = new changeImfor(); chanInfo.Show(); this.Hide(); } else { Form3 form3 = new Form3(); form3.Show(); this.Hide(); } }
private void changeImfor_FormClosing(object sender, FormClosingEventArgs e) { Form3 form3 = new Form3(); form3.Show(); this.Hide(); }