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.
- Using System. Data;
- Using System. Data. SqlClient;
- Using System. Configuration;
- Using System. Web;
- Using System. Web. Security;
- Using System. Web. UI;
- Using System. Web. UI. WebControls;
- Using System. Web. UI. WebControls. WebParts;
- Using System. Web. UI. HtmlControls;
- Using MySQL (the best combination with PHP) DriverCS;
- /// <Summary>
Db Summary
- /// </Summary>
- Public class db
- {
- Public db ()
- {
- //
- // TODO: add the constructor logic here
- //
- }
- /* Public static SqlConnection createCon ()
- {
- Return new SqlConnection ("server = ..; database = ylcg; uid = sa; pwd = 123456 ;");
- }*/
- Public static MySQL (best combination with PHP) Connection createCon ()
- {
- Return new MySQL (the best combination with PHP) Connection (new MySQL (the best combination with PHP) ConnectionString ("localhost", "ylcg", "root ", "123456 "). asString );
- }
- /* Public static DataTable ylTable ()
- {
- SqlConnection con = db. createCon ();
- SqlDataAdapter sda = new SqlDataAdapter ();
- Sda. SelectCommand = new SqlCommand ("select * from yl", con );
- DataSet myds = new DataSet ();
- Sda. Fill (myds, "yl ");
- Sda. Dispose ();
- Con. Close ();
- Return myds. Tables ["yl"];
- }*/
- Public static DataTable ylTable ()
- {
- MySQL (the best combination with PHP) Connection con = db. createCon ();
- MySQL (the best combination with PHP) DataAdapter sda = new MySQL (the best combination with PHP) DataAdapter ();
- Sda. SelectCommand = new MySQL (the best combination with PHP) Command ("select * from yl", con );
- DataSet myds = new DataSet ();
- Sda. Fill (myds, "yl ");
- Sda. Dispose ();
- Con. Close ();
- Return myds. Tables ["yl"];
- }
- /* Public static void insertNew (int num)
- {
- SqlConnection con = db. createCon ();
- SqlCommand cmd = new SqlCommand ();
- Try
- {
- For (int I = 0; I <100; I ++)
- {
- String [] times = {"00:10", "00:20", "00:30", "00:40", "00:50 ",
- ",
- ",
- ",
- ",
- "05:10", "05:20", "05:30", "05:40", "05:50 ",
- "06:10", "06:20", "06:30", "06:40", "06:50 ",
- "07:10", "07:20", "07:30", "07:40", "07:50 ",
- ",
- "10: 10", "10: 20", "10: 30", "10: 40", "10: 50 ",
- "11: 10", "11: 20", "11: 30", "11: 40", "11: 50 ",
- "12: 10", "12: 20", "12: 30", "12: 40", "12: 50 ",
- ",
- ",
- "15: 10", "15: 20", "15: 30", "15: 40", "15: 50 ",
- "16: 10", "16: 20", "16: 30", "16: 40", "16: 50 ",
- "10 10", "17:20", "17:30", "17:40", "17:50 ",
- ",
- "19:10", "19:20", "19:30", "19:40", "19:50 "};
- System. Random r = new Random ();
- Int myyl = r. Next (1120,189 0 );
- String SQL = "insert into yl values ('" + times [I]. ToString () + "'," + myyl + ", 11 )";
- // System. Web. HttpContext. Current. Response. Write (SQL );
- Con. Open ();
- Cmd. Connection = con;
- Cmd. CommandType = CommandType. Text;
- Cmd. CommandText = SQL;
- Cmd. ExecuteNonQuery ();
- Cmd. Dispose ();
- Con. Close ();
- }
- }
- Catch
- {
- System. Web. HttpContext. Current. Response. Write ("dd ");
- }
-
- }*/
- Public static void insertNew (int num)
- {
- MySQL (the best combination with PHP) Connection con = db. createCon ();
- MySQL (the best combination with PHP) Command cmd = new MySQL (the best combination with PHP) Command ();
- Try
- {
- For (int I = 0; I <100; I ++)
- {
- String [] times = {"00:10", "00:20", "00:30", "00:40", "00:50 ",
- ",
- ",
- ",
- ",
- "05:10", "05:20", "05:30", "05:40", "05:50 ",
- "06:10", "06:20", "06:30", "06:40", "06:50 ",
- "07:10", "07:20", "07:30", "07:40", "07:50 ",
- ",
- "10: 10", "10: 20", "10: 30", "10: 40", "10: 50 ",
- "11: 10", "11: 20", "11: 30", "11: 40", "11: 50 ",
- "12: 10", "12: 20", "12: 30", "12: 40", "12: 50 ",
- ",
- ",
- "15: 10", "15: 20", "15: 30", "15: 40", "15: 50 ",
- "16: 10", "16: 20", "16: 30", "16: 40", "16: 50 ",
- "10 10", "17:20", "17:30", "17:40", "17:50 ",
- ",
- "19:10", "19:20", "19:30", "19:40", "19:50 "};
- System. Random r = new Random ();
- Int myyl = r. Next (1120,189 0 );
- String SQL = "insert into yl (sendtime, sendvalue, cgID) values ('" + times [I]. toString () + "'," + myyl + ", 11 )";
- // System. Web. HttpContext. Current. Response. Write (SQL );
- Con. Open ();
- Cmd. Connection = con;
- Cmd. CommandType = CommandType. Text;
- Cmd. CommandText = SQL;
- Cmd. ExecuteNonQuery ();
- Cmd. Dispose ();
- Con. Close ();
- }
- }
- Catch
- {
- System. Web. HttpContext. Current. Response. Write ("dd ");
- }
- }
- }
- 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
- Y, sendtime varchar (20), sendvalue int (10), cgID int (10) not null) ENGINE = MyISAM
- 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.