Advertisement
Guest User

Untitled

a guest
Jun 15th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. MySqlConnection mson = new MySqlConnection("datasource/localhost;port=3306,username=root,password=password");
  2. MySqlCommand mcd;
  3. MySqlDataReader mdr;
  4.  
  5. public Form1()
  6. {
  7. InitializeComponent();
  8. }
  9.  
  10. // The following section is to make the frameless-form draggable :Begin
  11. protected override void WndProc(ref Message m)
  12. {
  13. base.WndProc(ref m);
  14. if (m.Msg == WM_NCHITTEST)
  15. m.Result = (IntPtr)(HT_CAPTION);
  16. }
  17.  
  18. private const int WM_NCHITTEST = 0x84;
  19. private const int HT_CLIENT = 0x1;
  20. private const int HT_CAPTION = 0x2;
  21.  
  22.  
  23. //::End::
  24.  
  25. private void button2_Click(object sender, EventArgs e) //Exit button
  26. {
  27. this.Close();
  28. }
  29.  
  30. private void Form1_Load(object sender, EventArgs e)
  31. {
  32. // TODO: This line of code loads data into the 'airtelWorkDataSet.table1' table. You can move, or remove it, as needed.
  33. this.table1TableAdapter.Fill(this.airtelWorkDataSet.table1);
  34.  
  35. }
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44. private void btn_add_Click(object sender, EventArgs e)
  45. {
  46. try
  47. {
  48.  
  49.  
  50. string strsql = "insert into table1 (ID,Source IP,Source Misc_ IP,Destination IP,Misc. Destination IP,Application,Protocol,Port)values('" + ipAddressControl1.Text + "','" + ipAddressControl2.Text + "','" + ipAddressControl3.Text + "','" + ipAddressControl4.Text + "','" + ipAddressControl5.Text + "','" + ipAddressControl6.Text + "','" + ipAddressControl7.Text + "')";
  51.  
  52.  
  53. }
  54. catch (Exception ex)
  55. {
  56. MessageBox.Show(ex.Message);
  57. }
  58. finally
  59. {
  60. mdr.Close();
  61. mson.Close();
  62. }
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement