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 treeview_grossalary { public partial class Form1 : Form { SqlConnection con = new SqlConnection("Data Source=CIODEV03\\SQLEXPRESS;Initial Catalog=EmployeeDB;Integrated Security=True"); SqlCommand cmd = new SqlCommand(); public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { getdata(); } private void getdata() { string str = "select * from gridsalry"; SqlDataAdapter ada = new SqlDataAdapter(str, con); DataSet ds = new DataSet(); ada.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; } private void btnsave_Click_1(object sender, EventArgs e) { string str = "insert into gridsalry values('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "','" + textBox8.Text + "')"; con.Open(); cmd = new SqlCommand(str, con); cmd.ExecuteNonQuery(); con.Close(); getdata(); } } }
e.Keychar == (char)13
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)