Exemplo n.º 1
0
        private void button_Save_Click(object sender, EventArgs e)
        {
            string SQL_Insert = "INSERT INTO Visit_Table (Real_Name, Phone, Visit_Date, Visit_Reamrk, Visit_Place, Visit_Type) VALUES ('" + textBox_Name.Text.Trim() + "', '" + textBox_Phone.Text.Trim() + "', '" + dateTimePicker_Visit.Value.ToShortDateString() + "', '" + richTextBox_Remark.Text.Trim() + "','" + richTextBox_Place.Text.Trim() + "', '" + Class_State.Windows_State + "')";
            //
            string SQL_Check = "SELECT * FROM Visit_Table WHERE Real_Name = '" + textBox_Name.Text.Trim() + "'  AND Visit_Type = '" + Class_State.Windows_State + "' AND Visit_Date LIKE '" + dateTimePicker_Visit.Value.ToShortDateString() + "'";

            //
            if (Class_SQL_Deal.Check_SQL(SQL_Check) != 0)
            {
                MessageBox.Show("您要保存的记录已经存在!", "Tips", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                if (Class_SQL_Deal.Insert_SQL(SQL_Insert) == 1)
                {
                    MessageBox.Show("记录保存成功!", "Tips", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Close();
                }
            }
        }
Exemplo n.º 2
0
 private void Button_Save_Click(object sender, EventArgs e)
 {
     if (Class_Control_Deal.Check_TextBox_Null(textBox_Name) == 0)
     {
         MessageBox.Show("姓名不能为空!", "Tips", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         #region 数据库添加操作
         Class_SQL_Deal.Open_Connection();
         //
         String SQL_Checked = String.Empty;
         SQL_Checked += "Select * From Archive_Table Where Real_Name = '" + textBox_Name.Text.Trim() + "' AND Archive_Type = '" + Archive_Type + "'  AND Phone = '" + textBox_Phone.Text.Trim() + "'";
         //
         if (Class_SQL_Deal.Check_SQL(SQL_Checked) == 1)
         {
             MessageBox.Show("您要存入的记录已经存在,无法添加!", "Tips", MessageBoxButtons.OK, MessageBoxIcon.Information);
             SQL_Checked = String.Empty;
         }
         else
         {
             String SQL_Insert = String.Empty;
             SQL_Insert += "INSERT INTO Archive_Table ";
             SQL_Insert += " (Real_Name, Phone, Address, Now_Company, Passed_Company, Skills, Birth, Qualifications, Graduate_School, Skilled_Sport, Marriage_State, Spouse_Name, Spouse_Birth, Father_Name, Father_Birth, Monther_Name, Monther_Birth, Sister_Brother_State, Son_Daughter_State, Best_Friend, Long_Carrer, Short_Carrer, Like_Dish, Like_Travel, Like_Sport, Like_Car, Like_Topic, Is_Train, Like_Lecturer, Is_Reader, Like_Book_Type, Is_Movie, Like_Movie_Type, Like_Friend_Type, The_3_Effect_People, Pride_Thing, Level_Type, Notes, Archive_Type, Now_Work, Passed_Work, Now_Live)";
             SQL_Insert += " VALUES ('" + textBox_Name.Text.Trim() + "', '" + textBox_Phone.Text.Trim() + "', '" + textBox_Home_Address.Text.Trim() + "', '" + textBox_Now_Company.Text.Trim() + "', '" + textBox_Passed_Company.Text.Trim() + "', '" + textBox_Skills.Text.Trim() + "', '" + dateTimePicker_Birth.Value.ToShortDateString() + "', '" + textBox_Qualifications.Text.Trim() + "', '" + textBox_Graduate_School.Text.Trim() + "', '" + textBox_Good_Sports.Text.Trim() + "', '" + textBox_Marriage_State.Text.Trim() + "', '" + textBox_Spouse_Name.Text.Trim() + "', '" + dateTimePicker_Spouse.Value.ToShortDateString() + "', '" + textBox_Father_Name.Text.Trim() + "','" + dateTimePicker_Farther.Value.ToShortDateString() + "', '" + textBox_Mother_Name.Text.Trim() + "', '" + dateTimePicker_Monther.Value.ToShortDateString() + "', '" + richTextBox_Sister_Brother_State.Text.Trim() + "', '" + richTextBox_Son_Daughter_State.Text.Trim() + "', '" + textBox_Best_Friend.Text.Trim() + "', '" + richTextBox_Long_Carrer.Text.Trim() + "', '" + richTextBox_Short_Carrer.Text.Trim() + "', '" + textBox_Like_Dish.Text.Trim() + "', '" + textBox_Like_Travel.Text.Trim() + "', '" + textBox_Like_Sports.Text.Trim() + "', '" + textBox_Like_Car.Text.Trim() + "', '" + textBox_Like_Topic.Text.Trim() + "', '" + textBox_Is_Train.Text.Trim() + "', '" + textBox_Like_Teacher.Text.Trim() + "', '" + textBox_Is_Reading.Text.Trim() + "', '" + textBox_Like_Booktype.Text.Trim() + "', '" + textBox_Is_Movie.Text.Trim() + "', '" + textBox_Like_Movie.Text.Trim() + "', '" + textBox_Like_Friendtype.Text.Trim() + "', '" + textBox_Effect_People.Text.Trim() + "', '" + textBox_Pride_Thing.Text.Trim() + "', '" + comboBox_Level_Type.Text.Trim() + "', '" + richTextBox_Notes.Text.Trim() + "', '" + Archive_Type + "', '" + textBox_Now_Work.Text.Trim() + "', '" + textBox_Passed_Work.Text.Trim() + "', '" + textBox_Now_Address.Text.Trim() + "')";
             if (Class_SQL_Deal.Insert_SQL(SQL_Insert) == 1)
             {
                 MessageBox.Show("添加记录成功!", "Tips", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             SQL_Insert = String.Empty;
         }
         //
         Class_SQL_Deal.Close_Connection();
         //
         #endregion
     }
 }