This is A C# Practice code:
Video For Result:
- 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 dataentry
- {
- public partial class insertButton : Form
- {
- public insertButton()
- {
- InitializeComponent();
- }
- SqlConnection CON = new SqlConnection("Data Source=.;Initial Catalog=DATAENTRY;Integrated Security=True;Pooling=False");
- string GENDER;
- string STATUS;
- private void button9_Click(object sender, EventArgs e)
- {
- CON.Open();
- SqlDataAdapter SDA = new SqlDataAdapter("INSERT INTO REGISTER (ID,NAME,GENDER,STATUS,AGE,SALARY,TAX) VALUES ('" + textBox1.Text + "','" + textBox2.Text + "','" + GENDER + "','" + STATUS + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "')", CON);
- SDA.SelectCommand.ExecuteNonQuery();
- CON.Close();
- MessageBox.Show("SAVED SUCCEESSFULLY !!!!!");
- }
- private void radioButton1_CheckedChanged(object sender, EventArgs e)
- {
- GENDER = "MALE";
- }
- private void radioButton2_CheckedChanged(object sender, EventArgs e)
- {
- GENDER = "FEMALE";
- }
- private void insertButton_Load(object sender, EventArgs e)
- {
- }
- private void checkBox1_CheckedChanged(object sender, EventArgs e)
- {
- STATUS = "MARRIED";
- }
- private void checkBox2_CheckedChanged(object sender, EventArgs e)
- {
- STATUS = "UNMARRIED";
- }
- }
- }
Facebook Comment