MySQL database and sqlserver pressure monitoring program practices

Source: Internet
Author: User

Do you feel a headache for the actual operations of the Pressure Monitoring Program MySQL database and sqlserver? Don't worry, the following article will give you the corresponding solution. The following article mainly introduces the solution for obtaining the pressure monitoring program MySQL database and sqlserver. The specific content is described below.

 
 
  1. Using System. Data;
  2. Using System. Data. SqlClient;
  3. Using System. Configuration;
  4. Using System. Web;
  5. Using System. Web. Security;
  6. Using System. Web. UI;
  7. Using System. Web. UI. WebControls;
  8. Using System. Web. UI. WebControls. WebParts;
  9. Using System. Web. UI. HtmlControls;
  10. Using MySQL (the best combination with PHP) DriverCS;
  11. /// <Summary>

Db Summary

 
 
  1. /// </Summary>
  2. Public class db
  3. {
  4. Public db ()
  5. {
  6. //
  7. // TODO: add the constructor logic here
  8. //
  9. }
  10. /* Public static SqlConnection createCon ()
  11. {
  12. Return new SqlConnection ("server = ..; database = ylcg; uid = sa; pwd = 123456 ;");
  13. }*/
  14. Public static MySQL (best combination with PHP) Connection createCon ()
  15. {
  16. Return new MySQL (the best combination with PHP) Connection (new MySQL (the best combination with PHP) ConnectionString ("localhost", "ylcg", "root ", "123456 "). asString );
  17. }
  18. /* Public static DataTable ylTable ()
  19. {
  20. SqlConnection con = db. createCon ();
  21. SqlDataAdapter sda = new SqlDataAdapter ();
  22. Sda. SelectCommand = new SqlCommand ("select * from yl", con );
  23. DataSet myds = new DataSet ();
  24. Sda. Fill (myds, "yl ");
  25. Sda. Dispose ();
  26. Con. Close ();
  27. Return myds. Tables ["yl"];
  28. }*/
  29. Public static DataTable ylTable ()
  30. {
  31. MySQL (the best combination with PHP) Connection con = db. createCon ();
  32. MySQL (the best combination with PHP) DataAdapter sda = new MySQL (the best combination with PHP) DataAdapter ();
  33. Sda. SelectCommand = new MySQL (the best combination with PHP) Command ("select * from yl", con );
  34. DataSet myds = new DataSet ();
  35. Sda. Fill (myds, "yl ");
  36. Sda. Dispose ();
  37. Con. Close ();
  38. Return myds. Tables ["yl"];
  39. }
  40. /* Public static void insertNew (int num)
  41. {
  42. SqlConnection con = db. createCon ();
  43. SqlCommand cmd = new SqlCommand ();
  44. Try
  45. {
  46. For (int I = 0; I <100; I ++)
  47. {
  48. String [] times = {"00:10", "00:20", "00:30", "00:40", "00:50 ",
  49. ",
  50. ",
  51. ",
  52. ",
  53. "05:10", "05:20", "05:30", "05:40", "05:50 ",
  54. "06:10", "06:20", "06:30", "06:40", "06:50 ",
  55. "07:10", "07:20", "07:30", "07:40", "07:50 ",
  56. ",
  57. "10: 10", "10: 20", "10: 30", "10: 40", "10: 50 ",
  58. "11: 10", "11: 20", "11: 30", "11: 40", "11: 50 ",
  59. "12: 10", "12: 20", "12: 30", "12: 40", "12: 50 ",
  60. ",
  61. ",
  62. "15: 10", "15: 20", "15: 30", "15: 40", "15: 50 ",
  63. "16: 10", "16: 20", "16: 30", "16: 40", "16: 50 ",
  64. "10 10", "17:20", "17:30", "17:40", "17:50 ",
  65. ",
  66. "19:10", "19:20", "19:30", "19:40", "19:50 "};
  67. System. Random r = new Random ();
  68. Int myyl = r. Next (1120,189 0 );
  69. String SQL = "insert into yl values ('" + times [I]. ToString () + "'," + myyl + ", 11 )";
  70. // System. Web. HttpContext. Current. Response. Write (SQL );
  71. Con. Open ();
  72. Cmd. Connection = con;
  73. Cmd. CommandType = CommandType. Text;
  74. Cmd. CommandText = SQL;
  75. Cmd. ExecuteNonQuery ();
  76. Cmd. Dispose ();
  77. Con. Close ();
  78. }
  79. }
  80. Catch
  81. {
  82. System. Web. HttpContext. Current. Response. Write ("dd ");
  83. }
  84.  
  85. }*/
  86. Public static void insertNew (int num)
  87. {
  88. MySQL (the best combination with PHP) Connection con = db. createCon ();
  89. MySQL (the best combination with PHP) Command cmd = new MySQL (the best combination with PHP) Command ();
  90. Try
  91. {
  92. For (int I = 0; I <100; I ++)
  93. {
  94. String [] times = {"00:10", "00:20", "00:30", "00:40", "00:50 ",
  95. ",
  96. ",
  97. ",
  98. ",
  99. "05:10", "05:20", "05:30", "05:40", "05:50 ",
  100. "06:10", "06:20", "06:30", "06:40", "06:50 ",
  101. "07:10", "07:20", "07:30", "07:40", "07:50 ",
  102. ",
  103. "10: 10", "10: 20", "10: 30", "10: 40", "10: 50 ",
  104. "11: 10", "11: 20", "11: 30", "11: 40", "11: 50 ",
  105. "12: 10", "12: 20", "12: 30", "12: 40", "12: 50 ",
  106. ",
  107. ",
  108. "15: 10", "15: 20", "15: 30", "15: 40", "15: 50 ",
  109. "16: 10", "16: 20", "16: 30", "16: 40", "16: 50 ",
  110. "10 10", "17:20", "17:30", "17:40", "17:50 ",
  111. ",
  112. "19:10", "19:20", "19:30", "19:40", "19:50 "};
  113. System. Random r = new Random ();
  114. Int myyl = r. Next (1120,189 0 );
  115. String SQL = "insert into yl (sendtime, sendvalue, cgID) values ('" + times [I]. toString () + "'," + myyl + ", 11 )";
  116. // System. Web. HttpContext. Current. Response. Write (SQL );
  117. Con. Open ();
  118. Cmd. Connection = con;
  119. Cmd. CommandType = CommandType. Text;
  120. Cmd. CommandText = SQL;
  121. Cmd. ExecuteNonQuery ();
  122. Cmd. Dispose ();
  123. Con. Close ();
  124. }
  125. }
  126. Catch
  127. {
  128. System. Web. HttpContext. Current. Response. Write ("dd ");
  129. }
  130. }
  131. }
  132. MySQL (best combination with PHP)> create table yl (ylID int (10) unsigned not null AUTO_INCREMENT Prima (the most complete VM management system) ry ke
  133. Y, sendtime varchar (20), sendvalue int (10), cgID int (10) not null) ENGINE = MyISAM
  134. AUTO_INCREMENT = 1 default charset = utf8;

The above content is an introduction to the pressure monitoring programs sqlserver and MySQL databases. I hope you will have some gains.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.