⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jl_tixing.cs

📁 此系统开发了一个公交车管理系统。系统根据权限的不同
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;

namespace CarManage
{
    public partial class JL_tixing : Form
    {
        public JL_tixing()
        {
            InitializeComponent();
        }

        private void JL_tixing_Load(object sender, EventArgs e)
        {
            DateTime dt = DateTime.Now;
            DateTime dt1 = dt.AddDays(-1);
            string str1 = dt.ToString("yyyy-MM-dd");
            String str = dt1.ToString("yyyy-MM-dd");
            this.lbLoadTime.Text = str1;
            this.lbBiaoxian.Text = str1;
            this.Way();
            this.Baoxian();

        }
        private void Way()
        {
            DateTime dt = DateTime.Now;
            DateTime dt1 = dt.AddDays(-1);
            string str1 = dt.ToString("yyyy-MM-dd");
            String str = dt1.ToString("yyyy-MM-dd");
            this.lbLoadTime.Text = str1;
            this.lbBiaoxian.Text = str1;
            DateTime loadtime =Convert.ToDateTime(str.ToString());
            string dl = ConfigurationManager.AppSettings["sqlString"];
            //创建connection对象con进行连接
            SqlConnection con = new SqlConnection(dl);
            //打开连接
            con.Open();
            string sql = "select car_number as 车牌号,car_rank as 品牌,car_fee as 养路费,car_feestart as 养路费起始时间,car_feeend as 养路费结束时间,car_remark as 备注 from db_car where car_feeend = '" + loadtime + "'";
            SqlCommand cmd = new SqlCommand(sql, con);
            SqlDataAdapter sdr = new SqlDataAdapter();
            //sdr的查询方法为cmd
            sdr.SelectCommand = cmd;
            //创建一个dataset容器
            DataSet ds = new DataSet();
            //填充数据ds
            sdr.Fill(ds);
            this.GridViewLoad.DataSource = ds.Tables[0].DefaultView;
            GridViewLoad.Columns[0].Width = 75;
            GridViewLoad.Columns[1].Width = 100;
            GridViewLoad.Columns[2].Width = 70;
            GridViewLoad.Columns[3].Width = 120;
            GridViewLoad.Columns[4].Width = 120;
            GridViewLoad.Columns[5].Width = 150;
        }
        private void Baoxian()
        {
            DateTime dt = DateTime.Now;
            DateTime dt1 = dt.AddDays(-1);
            string str1 = dt.ToString("yyyy-MM-dd");
            String str = dt1.ToString("yyyy-MM-dd");
            this.lbLoadTime.Text = str1;
            this.lbBiaoxian.Text = str1;
            DateTime Biaoxian = Convert.ToDateTime(str.ToString());
            string dl = ConfigurationManager.AppSettings["sqlString"];
            //创建connection对象con进行连接
            SqlConnection con = new SqlConnection(dl);
            //打开连接
            con.Open();
            string sql = "select car_number as 车牌号,car_rank as 品牌,car_insurance as 保险费,car_instart as 保险费起始时间,car_inend as 保险费结束时间,car_remark as 备注 from db_car where car_inend = '" + Biaoxian + "'";
            SqlCommand cmd = new SqlCommand(sql, con);
            SqlDataAdapter sdr = new SqlDataAdapter();
            //sdr的查询方法为cmd
            sdr.SelectCommand = cmd;
            //创建一个dataset容器
            DataSet ds = new DataSet();
            //填充数据ds
            sdr.Fill(ds);
            this.GridViewbaoxian.DataSource = ds.Tables[0].DefaultView;
            GridViewbaoxian.Columns[0].Width = 75;
            GridViewbaoxian.Columns[1].Width = 100;
            GridViewbaoxian.Columns[2].Width = 70;
            GridViewbaoxian.Columns[3].Width = 120;
            GridViewbaoxian.Columns[4].Width = 120;
            GridViewbaoxian.Columns[5].Width = 150;
        }

        private void tabPage2_Click(object sender, EventArgs e)
        {

        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -