数据库
首页 > 数据库> > Winfrom 添加窗体和保存数据到数据库

Winfrom 添加窗体和保存数据到数据库

作者:互联网

1.fMain界面点击按钮跳转窗体到fMainadad   private void barButtonItem5_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)         {             fMainadd fma = new fMainadd();             //Data(material_no);             if (fma.ShowDialog() == DialogResult.OK)             {                 barButtonItem5_ItemClick(sender, e);             }         }     2.fMainadad添加保存数据到数据库   private void button1_Click(object sender, EventArgs e)         {                                if (string.IsNullOrEmpty(txt_FG_MATERIAL_NO.Text.Trim()) || string.IsNullOrEmpty(txt_IS_MUST.Text.Trim()) || string.IsNullOrEmpty(txt_IS_BATCH.Text.Trim()))             {                 MessageBox.Show("请填写完成信息!", "提示");                 return;             }             SYS_COMMON_PROXY COM_PROXY = new SYS_COMMON_PROXY();             string sql = @"insert into EPM_PROCESS_KEY_PART_CONTROL(FG_MATERIAL_NO,PROCESS_CODE,RM_MATERIAL_NO,BARCODE_PARASER_CONFIG,IS_MUST,USED_QTY,IS_BATCH) values('" + txt_FG_MATERIAL_NO.Text.Trim() + "','" + txt_PROCESS_CODE.Text.Trim() + "','" + txt_RM_MATERIAL_NO.Text.Trim() + "','" + txt_BARCODE_PARASER_CONFIG.Text.Trim() + "','" + txt_IS_MUST.Text.Trim() + "','" + txt_USED_QTY.Text.Trim() + "','" + txt_IS_BATCH.Text.Trim() + "') "; --数据库语句             int RES = COM_PROXY.ExecuteNonQuery(sql);             COM_PROXY.CloseChannel();             if (RES > 0)             {                 MessageBox.Show("保存成功", "提示");                 this.Close();             }         }

标签:Trim,NO,Winfrom,数据库,MATERIAL,窗体,PROXY,Text,txt
来源: https://www.cnblogs.com/zy-ww/p/14845763.html