Main.cs

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

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 System.Data.SqlClient;
using Phone.DBHelper;
namespace Phone
{
    public partial class Main : Form
    {
        public Main()
        {
            InitializeComponent();
          
        }
        //保存数据到数据库
        private void btnsave_Click(object sender, EventArgs e)
        {
           
        }
        public void update()
        {
            if (isNotNull() ==true)
            {
                if(this.dgvphone.SelectedRows.Count==0){
                    MessageBox.Show("请选中所要修改的数据");
                }
                else
                {
                    StringBuilder sql = new StringBuilder();
                    sql.Append("update PhoneNum set pTypeId=@pTypeId");
                    List<SqlParameter> paramList = new List<SqlParameter>();
                    if(this.comGroup.Text!=null && this.comGroup.Text!=""){
                        paramList.Add(new SqlParameter("@pTypeId",this.comGroup.SelectedValue));
                    }
                    if(this.txtNm.Text!=null && this.txtNm.Text != ""){
                        sql.Append(",pName=@pName");
                        paramList.Add(new SqlParameter("@pName", this.txtNm.Text));

                    }
                    if(this.txtPhone.Text!=null && this.txtPhone.Text!=""){
                        sql.Append(",pCellPhone=@pCellPhone");
                        paramList.Add(new SqlParameter("@pCellPhone",this.txtPhone.Text));
                    }
                    if(this.txtJiadian.Text!=null && this.txtJiadian.Text!=""){
                        sql.Append(",pHomePhone=@pHomePhone");
                        paramList.Add(new SqlParameter("@pHomePhone",this.txtJiadian.Text));
                    }
                    sql.Append("where pId=@pId");
                    paramList.Add(new SqlParameter("pId",dgvphone.SelectedRows[0].Cells["pId"].Value.ToString()));
                    int count = SqlHelper.ExecuteSQL(sql.ToString(),paramList.ToArray());
                    if (count>0)
                    {
                        MessageBox.Show("修改成功!");
                    }
后面还有 147 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。