Esempio n. 1
0
        private void insertData()
        {
            SqlConnection sqlconn = new SqlConnection(strConn);

            try
            {
                sqlconn.Open();
                string cmdText = "Insert Into RECRUIT (W_NUM,ID,NAME,SUBJECT,COM_NAME,FIELD, PAY, W_START_TIME, W_END_TIME, W_PLACE," +
                                 "W_DATE, PERIOD, W_CONTENT) VALUES(NEXT VALUE FOR W_NUMBER,@id,@name,@sbj,@com_name,@field,@pay,@start,@finish,@w_place,@time,@dead,@w_content)";
                SqlCommand cmd = new SqlCommand(cmdText, sqlconn);

                int intPay = Convert.ToInt32(Menu1.getPay());

                cmd.Parameters.AddWithValue("@id", MainForm.getID());
                cmd.Parameters.AddWithValue("@name", MainForm.getName());
                cmd.Parameters.AddWithValue("@sbj", Menu1.getSbj());
                cmd.Parameters.AddWithValue("@com_name", MainForm.getCom_name());
                cmd.Parameters.AddWithValue("@field", Menu1.getField());
                cmd.Parameters.AddWithValue("@pay", (intPay * 10000));
                cmd.Parameters.AddWithValue("@start", Menu1.getStart());
                cmd.Parameters.AddWithValue("@finish", Menu1.getFinish());
                cmd.Parameters.AddWithValue("@w_place", Menu1.getPlace());
                cmd.Parameters.AddWithValue("@time", DateTime.Now);
                cmd.Parameters.AddWithValue("@dead", Menu1.getDead());
                cmd.Parameters.AddWithValue("@w_content", Menu1.getContent());

                cmd.ExecuteNonQuery();


                onYesExit();
            }
            catch (Exception ee)
            {
                Log.printLog("공고 등록 오류");
                MessageBox.Show(ee.Message);
                MessageBox.Show(ee.StackTrace);
            }
            finally
            {
                sqlconn.Close();
            }
        }