-
Notifications
You must be signed in to change notification settings - Fork 0
/
FRMcountIns.cs
55 lines (52 loc) · 1.64 KB
/
FRMcountIns.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Reception
{
public partial class FRMcountIns : Form
{
public FRMcountIns()
{
InitializeComponent();
}
SqlDataAdapter da;
SqlConnection con = new SqlConnection("Data Source=PEDRAM-PC;Initial Catalog=ProjectREC;Integrated Security=True");
DataRow newRow;
SqlCommandBuilder cb;
DataTable dt = new DataTable();
DataSet ds = new DataSet();
private void FRMcountIns_Load(object sender, EventArgs e)
{
da = new SqlDataAdapter("SELECT * FROM Country", con);
cb = new SqlCommandBuilder(da);
da.Fill(ds, "Country");
}
private void btnInsert_Click(object sender, EventArgs e)
{
newRow = ds.Tables["Country"].NewRow();
//int ID;
//int natcode;
//ID = Convert.ToInt32(txtID.Text);
//natcode = Convert.ToInt32(txtnatID.Text);
SqlCommand cmd;
string qry;
qry = "INSERT INTO Country(CountryID,CountryName)VALUES('" + txtinscountid.Text + "','" + txtinsname.Text + "')";
con.Open();
cmd = new SqlCommand(qry, con);
cmd.ExecuteNonQuery();
da.Fill(ds, "Country");
con.Close();
MessageBox.Show("Successfully Done!");
}
private void btndel_Click(object sender, EventArgs e)
{
Close();
}
}
}