private void 值輸btn登入值日生系統_Click(object sender, EventArgs e) { if ((tb值日生姓名.Text.Length > 0) && (tb值日生班級.Text.Length > 0) && (tb值日生電話.Text.Length > 0)) { SqlConnection con = new SqlConnection(scsb.ToString()); con.Open(); string strSQL = "Insert Into 值日生Info(@new值日生班級,@new值日生姓名,@new值日生電話)"; SqlCommand cmd = new SqlCommand(strSQL, con); cmd.Parameters.AddWithValue("@New值日生班級", tb值日生班級.Text); cmd.Parameters.AddWithValue("@New值日生姓名", tb值日生姓名.Text); cmd.Parameters.AddWithValue("@New值日生電話", tb值日生電話.Text); Form值日生端 myform值日生端 = new Form值日生端(); Form學生端 myform學生端 = new Form學生端(); Form值日生輸入 myform值日生輸入資料 = new Form值日生輸入(); Form櫃台端 myform櫃台端 = new Form櫃台端(tb值日生姓名.Text); myform值日生端.Show(); //myform值日生端.ShowDialog(); myform值日生輸入資料.ShowInTaskbar = false; myform學生端.Show(); //myform學生端.ControlBox = false; //myform學生端.WindowState = FormWindowState.Minimized; myform學生端.Dispose(); con.Close(); } else { MessageBox.Show("請輸入完整資料"); } }
private void Form1_Load(object sender, EventArgs e) { DialogResult r; r = MessageBox.Show("肚子餓了吧!!!"); myform櫃台端.Show(); myform學生端.Show(); if (r == DialogResult.OK) { myform櫃台端.WindowState = FormWindowState.Minimized; myform學生端.WindowState = FormWindowState.Minimized; } }
private void 值btn選擇店家_Click(object sender, EventArgs e) { myform學生端.strMsg1 = 值tb店名.Text; SqlConnection con = new SqlConnection(scsb.ToString()); con.Open(); string strSQL = "insert into StoreInfoS values (@NewStoreName,@NewStorePhoneNum )"; SqlCommand cmd = new SqlCommand(strSQL, con); cmd.Parameters.AddWithValue("@NewStoreName", 值tb店名.Text); cmd.Parameters.AddWithValue("@NewStorePhoneNum", 值tb電話.Text); cmd.ExecuteNonQuery(); con.Close(); myform學生端.Show(); this.Visible = false; tabPage1.Parent = null; }
private void F1btn學生_Click(object sender, EventArgs e) { try { Form學生端 myform學生端 = new Form學生端(); SqlConnection con = new SqlConnection(scsb.ToString()); con.Open(); string strSQL = "select top 1 * from StoreInfoS order by StoreID desc"; SqlCommand cmd = new SqlCommand(strSQL, con); SqlDataReader reader = cmd.ExecuteReader(); reader.Read(); myform學生端.strMsg1 = string.Format("{0}", reader["StoreName"]); myform學生端.Show(); } catch { MessageBox.Show("值日生尚未選店"); } //myform學生端.WindowState = FormWindowState.Normal; }