Java教程

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();             }         }
这篇关于Winfrom 添加窗体和保存数据到数据库的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!