using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CCWin;
using System.Data.SqlClient;
namespace best
{
public partial class Form2 : CCSkinMain
{
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
}
private void skinButton1_Click(object sender, EventArgs e)
{
string uids = this.uid.Text;
string names = this.name.Text;
string sexs = this.sex.Text;
string dids = this.did.Text;
SqlConnection shu = new SqlConnection("server=.;database=bestr;uid=sa;pwd=123456");
shu.Open();
string sql = string.Format("insert Employee (EmpId,EmpName,EmpSex,DepId) values('{0}','{1}','{2}','{3}')", uids, names,sexs,dids);
SqlCommand ss = new SqlCommand(sql, shu);
int rows = ss.ExecuteNonQuery();
shu.Close();
if (rows > 0)
{
MessageBox.Show("添加成功");
this.Hide();
Form welcome = new welcome();
welcome.Show();
}
else
{
MessageBox.Show("添加失败");
}
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using CCWin;
using System.Data.SqlClient;
namespace best
{
public partial class Form2 : CCSkinMain
{
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
}
private void skinButton1_Click(object sender, EventArgs e)
{
string uids = this.uid.Text;
string names = this.name.Text;
string sexs = this.sex.Text;
string dids = this.did.Text;
SqlConnection shu = new SqlConnection("server=.;database=bestr;uid=sa;pwd=123456");
shu.Open();
string sql = string.Format("insert Employee (EmpId,EmpName,EmpSex,DepId) values('{0}','{1}','{2}','{3}')", uids, names,sexs,dids);
SqlCommand ss = new SqlCommand(sql, shu);
int rows = ss.ExecuteNonQuery();
shu.Close();
if (rows > 0)
{
MessageBox.Show("添加成功");
this.Hide();
Form welcome = new welcome();
welcome.Show();
}
else
{
MessageBox.Show("添加失败");
}
}
}
}