insert.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Data;
using System.Windows.Forms;
using System.Data.SqlClient;
using Phone.DBHelper;
namespace Phone
{
public partial class insert : Form
{
public insert()
{
InitializeComponent();
}
public Main form1;
private void btnInsert_Click(object sender, EventArgs e)
{
if (isNotNull()==true)
{
string sql = "insert into PhoneNum(pTypeId,pName,pCellPhone,pHomePhone) values(@pTypeId,@pName,@pCellPhone,@pHomePhone)";
List<SqlParameter> parameter = new List<SqlParameter>();
parameter.Add(new SqlParameter("@pTypeId",cboGroup.SelectedValue));
parameter.Add(new SqlParameter("@pName",txtName.Text));
parameter.Add(new SqlParameter("@pCellPhone",txtPhone.Text));
parameter.Add(new SqlParameter("@pHomePhone",txtsPhone.Text));
int count = SqlHelper.ExecuteSQL(sql,parameter.ToArray());
if(count>0){
MessageBox.Show("新增成功!");
form1.BindInfo();
this.Close();
}
}
else
{
MessageBox.Show("所输入内容不能为空");
}
}
//初始化群组信息
public void BingInfo()
{
string sql = "select ptId,ptName from PhoneType";
DataTable dt = SqlHelper.GetDataTable(sql,null);
//////////////////////////////////////////////
//////////////////////////////////////////////
this.cboGroup.DisplayMember = "ptName";
this.cboGroup.ValueMember = "ptId";
this.cboGroup.DataSource = dt;
}
//非空验证
public Boolean isNotNull()
{
string kong = "";
foreach (Control control in this.Controls)
{
if (control is TextBox)
{
后面还有 25 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。