📄 增加库存产品.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace 计量
{
public partial class 增加库存产品 : Form
{
public 增加库存产品()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string a = "", b = "", c = "", d = "", ee = "";
a = this.textBox1.Text.Trim();
b= this.textBox2.Text.Trim();
c= this.textBox3.Text.Trim();
d= this.textBox4.Text.Trim();
ee = this.textBox5.Text.Trim();
if(a=="" || b=="" || c=="" || d=="" || ee=="")
{
MessageBox.Show("请输入完整数据");
return;
}
try
{
int ii = this.库存类型TableAdapter.Insert(a,b,c,d,ee,0);
if (ii == 0) MessageBox.Show("增加失败");
else MessageBox.Show("增加成功");
this.Close();
}
catch (Exception exc)
{
MessageBox.Show("增加失败" + exc.Message);
}
}
private void 增加库存产品_Load(object sender, EventArgs e)
{
this.textBox1.Text = getid();
this.textBox1.ReadOnly = true;
}
private string getid()
{
string idtype = "CID1";
try
{
DataTable dt = this.库存类型TableAdapter.GetData();
DataRow[] dr = dt.Select("", "库存ID asc");
if (dr.Length != 0)
{
idtype = dr[dr.Length - 1].ItemArray[0].ToString().Trim();
idtype = "CID" + (int.Parse(idtype.Substring(3, idtype.Length - 3)) + 1);
return idtype;
}
}
catch (Exception exc)
{
MessageBox.Show(exc.Message);
}
return idtype;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -