Example #1
0
        private void btnSure_Click(object sender, EventArgs e)
        {
            DateTime Time     = DateTime.Now;
            String   StrToday = "";

            StrToday = Time.ToShortDateString().ToString();

            if ((cbDStudent.Text.Length > 0) && (cbCompanyName.Text.Length > 0))
            {
                SqlConnection con = new SqlConnection(scsb.ToString());
                con.Open();
                string     strSQL = "update Daily_Student set date=@StrToday,Comoany=@NewCompany where DS_name like @NewClass";
                SqlCommand cmd    = new SqlCommand(strSQL, con);



                cmd.Parameters.AddWithValue("@NewClass", cbDStudent.Text);
                cmd.Parameters.AddWithValue("@StrToday", StrToday);
                cmd.Parameters.AddWithValue("@NewCompany", cbCompanyName.Text);

                int rows = cmd.ExecuteNonQuery();
                con.Close();

                MessageBox.Show("已確定值日生");


                form1 form = new form1();
                form.name    = cbDStudent.Text;
                form.company = cbCompanyName.Text;

                //form.ShowDialog();
            }
            else
            {
                MessageBox.Show("兩者不可為空");
            }
        }
Example #2
0
        private void btnStudent_Click(object sender, EventArgs e)
        {
            form1 form = new form1();

            form.ShowDialog();
        }