private void btn_NEW_OK_Click(object sender, EventArgs e) { if (CHECK_MUST()) { SqlConnection cnn = new SqlConnection(DB_Access.Constr); SqlDataAdapter dataAdapter = new SqlDataAdapter(); string sql = SQL_TEXT.I_NEW_ART; SqlCommand cmd = new SqlCommand(sql, cnn); cmd.Parameters.Add("@ART_NO", SqlDbType.VarChar).Value = tb_NEW_ART.Text; cmd.Parameters.Add("@CONSTRUCTION", SqlDbType.VarChar).Value = tb_NEW_CONST.Text; cmd.Parameters.Add("@COMPOSITION", SqlDbType.VarChar).Value = tb_NEW_COMPO.Text; cmd.Parameters.Add("@WEIGHT", SqlDbType.VarChar).Value = tb_NEW_WEIGHT.Text; cmd.Parameters.Add("@REMARK", SqlDbType.VarChar).Value = tb_NEW_REMARK.Text; cmd.Parameters.Add("@COLOR", SqlDbType.VarChar).Value = tb_NEW_COLOR.Text; cmd.Parameters.Add("@ART_TYPE", SqlDbType.VarChar).Value = tbART_TYPE.Text; if (tb_NEW_PRICE.Text == "") { tb_NEW_PRICE.Text = "0"; } cmd.Parameters.Add("@PRICE", SqlDbType.VarChar).Value = double.Parse(tb_NEW_PRICE.Text); try { cnn.Open(); cmd.ExecuteNonQuery(); cmd.Dispose(); cnn.Close(); MessageBox.Show("新增成功!"); frmProdInfo f = (frmProdInfo)Enter_F; //Form1 ff = new Form1(); f.loadData(); f.RefreshGV(); this.Close(); } catch (Exception ex) { MessageBox.Show("新增失敗! 錯誤訊息:" + ex.Message); this.Close(); } } else { MessageBox.Show("請填寫必要欄位!"); } }
private void barButtonItem5_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //this.splitContainerControl.Panel2.Controls.Clear(); //pnMain.Controls.Clear(); ClearControls(); var form = new frmProdInfo(); form.TopLevel = false; form.FormBorderStyle = FormBorderStyle.None; form.Dock = DockStyle.Top; //form.WindowState = FormWindowState.Maximized; DevExpress.XtraEditors.VScrollBar vs1 = new DevExpress.XtraEditors.VScrollBar(); vs1.Dock = DockStyle.Right; //pnMain.Controls.Add(vs1); // splitContainerControl.Panel2.Controls.Add(form); pnMain.Controls.Add(form); pnMain.AutoScroll = true; form.Show(); }