资源简介


资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;



namespace 班级考勤
{
    public partial class add : Form
    {
        public add()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender EventArgs e)
        {
            string connString = @“Data Source=.;Initial Catalog=Table1;Integrated Security=True“;
            SqlConnection conn = null;
            SqlCommand cmd = null;
            try{
          
            conn = new SqlConnection(connString);
            conn.Open();
            cmd = conn.CreateCommand();
            cmd.CommandText = “insert into Table1(snopasswordgradesexdeptname) values(@sno@password@grade@sex@dept@name)“;
            cmd.Parameters.AddWithValue(“@name“ textBox1.Text.Trim());
            cmd.Parameters.AddWithValue(“@sno“ textBox2.Text.Trim());
            cmd.Parameters.AddWithValue(“@password“ textBox3.Text.Trim());
            cmd.Parameters.AddWithValue(“@sex“ textBox4.Text.Trim());
            cmd.Parameters.AddWithValue(“@grade“ textBox5.Text.Trim());
            cmd.Parameters.AddWithValue(“@dept“ textBox6.Text.Trim());
      /*    String sql = “insert into Table1(snopasswordgradesexdeptname)values(‘“ + textBox1.Text + “‘‘“ + textBox2.Text + “‘,‘“ + textBox3.Text + “‘,‘“ + textBox4.Text + “‘,‘“ + textBox5.Text + “‘,‘“ + textBox6.Text + “‘)“;
            SqlCommand comm = new SqlCommand(sql conn); */        
           

            int n = cmd.ExecuteNonQuery();
            if (n>0)
            {
                MessageBox.Show(“保存成功“ “ok“);
                this.Dispose(); 
                
            }
            else{MessageBox.Show(“保存失败“);}
        }
            catch(Exception ex)
            {
                MessageBox.Show(“保存失败“ex.MessageMessageBoxButtons.OK);
            }
            finally
            {
              
                if (conn.State == ConnectionState.Open) conn.Close();

            }
                   
           
       }


        private void label2_Click(object sender EventArgs e)
        {

        }

        private void button2_Click(object sender EventArgs e)
        {
            this.Dispose();
            
        }

    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件        2512  2020-12-18 17:15  班级考勤\add.cs
     文件        8694  2020-12-17 20:37  班级考勤\add.Designer.cs
     文件        5817  2020-12-17 19:40  班级考勤\add.resx
     文件         454  2020-12-11 23:45  班级考勤\app.config
     目录           0  2020-12-11 23:34  班级考勤\bin\
     目录           0  2020-12-12 09:20  班级考勤\bin\Debug\
     文件     2359296  2020-12-18 16:49  班级考勤\bin\Debug\Database1.mdf
     文件      589824  2020-12-18 16:49  班级考勤\bin\Debug\Database1_log.ldf
     文件       29696  2020-12-18 17:31  班级考勤\bin\Debug\班级考勤.exe
     文件         454  2020-12-11 23:45  班级考勤\bin\Debug\班级考勤.exe.config
     文件       75264  2020-12-18 17:31  班级考勤\bin\Debug\班级考勤.pdb
     文件       11600  2020-12-18 19:08  班级考勤\bin\Debug\班级考勤.vshost.exe
     文件         454  2020-12-11 23:45  班级考勤\bin\Debug\班级考勤.vshost.exe.config
     文件         490  2019-03-19 12:47  班级考勤\bin\Debug\班级考勤.vshost.exe.manifest
     文件     2359296  2020-12-18 19:19  班级考勤\Database1.mdf
     文件      589824  2020-12-18 19:19  班级考勤\Database1_log.LDF
     文件       13269  2020-12-11 23:45  班级考勤\Database1DataSet.Designer.cs
     文件           3  2020-12-11 23:45  班级考勤\Database1DataSet.xsc
     文件        1685  2020-12-11 23:45  班级考勤\Database1DataSet.xsd
     文件           3  2020-12-11 23:45  班级考勤\Database1DataSet.xss
     文件        2431  2020-12-18 17:21  班级考勤\Form1.cs
     文件        4155  2020-12-16 21:41  班级考勤\Form1.Designer.cs
     文件        5817  2020-12-16 21:41  班级考勤\Form1.resx
     文件         744  2020-12-16 22:03  班级考勤\Form2.cs
     文件        2680  2020-12-16 22:03  班级考勤\Form2.Designer.cs
     文件        5817  2020-12-16 22:03  班级考勤\Form2.resx
     文件        3072  2020-12-18 17:31  班级考勤\Form3.cs
     文件        6104  2020-12-17 19:40  班级考勤\Form3.Designer.cs
     文件        5817  2020-12-17 19:40  班级考勤\Form3.resx
     文件        2660  2020-12-18 17:05  班级考勤\Form4.cs
     文件        6991  2020-12-18 11:13  班级考勤\Form4.Designer.cs
............此处省略34个文件信息

评论

共有 条评论