色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

mysql模擬查詢in,如何建立查詢消費賬單

榮姿康2年前30瀏覽0評論
mysql模擬查詢in,如何建立查詢消費賬單?

//獲得數據寫入text(主方法)

privatevoidcount(objectsender,EventArgse){stringstr1="select*from表名where條件"

;//讀取整張表MySqlConnectioncoon=MySQL.getMySqlCon()

;//連接數據庫,調方法MySqlCommandmySqlCommand1=MySQL.getSqlCommand(str1,coon);coon.Open();intrecord1=MySQL.getResultCount(mySqlCommand1);coon.Close();label1.Text=record1.ToString();

}//建立執行命令的語句對象publicstaticMySqlCommandgetSqlCommand(Stringsql,MySqlConnectionmysql){MySqlCommandmySqlCommand=newMySqlCommand(sql,mysql);returnmySqlCommand;}//查詢記錄數publicstaticintgetResultCount(MySqlCommandmySqlCommand){MySqlDataReaderreader=mySqlCommand.ExecuteReader();intresult=0;try{while(reader.Read()){if(reader.HasRows){result=result+1;}}}catch(Exception){}finally{reader.Close();}returnresult;

}//此方法連接數據庫publicstaticMySqlConnectiongetMySqlCon(){StringmysqlStr="Database=test3;DataSource=127.0.0.1;UserId=root;Password=123456;pooling=false;CharSet=utf8;port=3306;AllowZeroDatetime=True";MySqlConnectionmysql=newMySqlConnection(mysqlStr)

;returnmysql;}