91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 35KB
    文件類(lèi)型: .7z
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-05-22
  • 語(yǔ)言: C#
  • 標(biāo)簽:

資源簡(jiǎn)介

C#空氣質(zhì)量監(jiān)測(cè)管理系統(tǒng).7z

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
using?System.Data.SqlClient;

namespace?空氣質(zhì)量監(jiān)測(cè)管理系統(tǒng)
{
????public?partial?class?Form2?:?Form
????{
????????public?Form2()
????????{
????????????InitializeComponent();
????????}

????????//獲取地址
????????static?string?url?=?“Data?Source=.;Initial?Catalog=AirQualityDB;User?ID=陳世洲;Password=123456“;
????????//創(chuàng)建SqlConnection對(duì)象
????????SqlConnection?conn?=?new?SqlConnection(url);
????????//創(chuàng)建DataSet對(duì)象
????????DataSet?ds?=?new?DataSet();

??????
????????//窗體加載事件
????????private?void?Form2_Load(object?sender?EventArgs?e)
????????{
????????????//顯示下拉框信息
????????????ShowStatic();
????????}
????????//顯示下拉框信息
????????public?void?ShowStatic()?{
????????????//定義sql語(yǔ)句
????????????string?sql?=?“select?StationIDStationName?from?StationInfo“;
????????????//創(chuàng)建SqlDataAdapter對(duì)象
????????????SqlDataAdapter?data?=?new?SqlDataAdapter(sqlconn);
????????????//填充數(shù)據(jù)
????????????data.Fill(ds?“StationInfo“);
????????????//綁定數(shù)據(jù)
????????????this.cb_typeName.DataSource?=?ds.Tables[“StationInfo“];
????????????this.cb_typeName.ValueMember?=?“StationID“;
????????????this.cb_typeName.DisplayMember?=?“StationName“;
????????
????????
????????}
????????//提交按鈕
????????private?void?bt_insert_Click(object?sender?EventArgs?e)
????????{
????????????//異常處理
????????????try
????????????{
????????????????//非空檢驗(yàn)
????????????????if?(this.tb_Name.Text.Trim().Equals(““)?||?this.tb_StartTime.Text.Trim().Equals(““)?||?this.tb_StopTime.Text.Trim().Equals(““)?||?this.tb_Pm.Text.Trim().Equals(““)?||?this.tb_Level.Text.Trim().Equals(““)?||?this.tb_zy.Text.Trim().Equals(““))
????????????????{
????????????????????MessageBox.Show(“所有信息都不能為空“?“操作提示!“?MessageBoxButtons.OK?MessageBoxIcon.Information);
????????????????}
????????????????else
????????????????{
???????????????????
????????????????????//打開(kāi)連接
????????????????????conn.Open();
????????????????????//定義sql語(yǔ)句
????????????????????string?sql?=?“insert?into?AirQualityInfo?values(“+this.cb_typeName.SelectedValue+“‘“+this.tb_Name.Text.Trim()+“‘‘“+this.tb_StartTime.Text.Trim()+“‘‘“+this.tb_StopTime.Text.Trim()+“‘“+this.tb_Pm.Text.Trim()+““+this.tb_Level.Text.Trim()+“‘“+this.tb_zy.Text.Trim()+“‘)“;
????????????????????//創(chuàng)建sqlcommand對(duì)象
????????????????????SqlCommand?com?=?new?SqlCommand(sql?conn);
????????????????????//執(zhí)行sql語(yǔ)句
????????????????????int?i?=?com.ExecuteNonQuery();
????????????????????if?(i?>?0)
????????????????????{
????????????????????????MessageBox.Show(“添加成功!“?“操作提示!“?MessageBoxButtons.OK?MessageBoxIcon.Information);
????????????????????}
????????????????????else
????????????????????{
????????????????????????MessageBox.Show(“添加失敗!“?“操作提示!“?MessageBoxButtons.OK?MessageBoxIcon.Information);
????????????????????}
????????????????}
????????????}

評(píng)論

共有 條評(píng)論

相關(guān)資源