using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Data.SqlClient; using System.Text; using System.Windows.Forms; namespace empinformation { public partial class Form1 : Form { public Form1() { InitializeComponent(); } DataTable dt; int currenrec = 0; int totalrec = 0; static SqlConnection con = new SqlConnection("user id=sa; password=123;database=work"); static SqlDataAdapter da = new SqlDataAdapter("select * from emp", con); DataSet ds = new DataSet(); private void button1_Click(object sender, EventArgs e) { da.Fill(ds, "emp"); dt = ds.Tables["emp"]; currenrec = 0; totalrec = dt.Rows.Count; FillControls(); btnext.Enabled = true; btprev.Enabled = true; } private void FillControls() { txtemp.Text = dt.Rows[currenrec]["empno"].ToString(); txtename.Text = dt.Rows[currenrec]["ename"].ToString(); txtjob.Text = dt.Rows[currenrec]["job"].ToString(); txtsal.Text = dt.Rows[currenrec]["sal"].ToString(); txthrd.Text = dt.Rows[currenrec]["hiredate"].ToString(); txtcom.Text = dt.Rows[currenrec]["comm"].ToString(); txtdept.Text = dt.Rows[currenrec]["deptno"].ToString(); } private void btnext_Click(object sender, EventArgs e) { currenrec += 1; if (currenrec >= totalrec) { currenrec = 0; } FillControls(); } private void btprev_Click(object sender, EventArgs e) { currenrec -= 1; if (currenrec <= totalrec) { currenrec = totalrec-1; } FillControls(); } private void btnew_Click(object sender, EventArgs e) { SqlCommand cmd = new SqlCommand(); } private void btsve_Click(object sender, EventArgs e) { } private void btdel_Click(object sender, EventArgs e) { } } }
insert into emp (HERE ENUM FIELDS) values(HERE ENUM VAULES)
private static void CreateCommand(string queryString, string connectionString){ using (SqlConnection connection = new SqlConnection( connectionString)) { SqlCommand command = new SqlCommand(queryString, connection); command.Connection.Open(); command.ExecuteNonQuery(); }}
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)