📄 menuclass.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;
namespace pwxt
{
public partial class menuclass : Form
{
public menuclass()
{
InitializeComponent();
}
private void menuclass_Load(object sender, EventArgs e)
{
lv.View = View.Details;
lv.Columns.Add("车次", lv.Width / 6, HorizontalAlignment.Left);
lv.Columns.Add("时间", lv.Width / 6, HorizontalAlignment.Left);
lv.Columns.Add("路线", (lv.Width) * 2 / 3, HorizontalAlignment.Left);
SqlConnection conn = new SqlConnection("server=127.0.0.1;uid=;pwd=;database=USer");
SqlCommand cmd = new SqlCommand("Select * From lxtable", conn);
SqlDataReader odr = null;
conn.Open();
odr = cmd.ExecuteReader();
if (odr != null)
{
while (odr.Read())
{
ListViewItem lvi = new ListViewItem();
lvi.Text = odr["车次"].ToString();
lvi.SubItems.Add(odr["时间"].ToString());
lvi.SubItems.Add(odr["路线"].ToString());
lv.Items.Add(lvi);
}
odr.Close();
conn.Close();
}
}
private void button1_Click(object sender, EventArgs e)
{
this.Visible = false;
try
{
goupiao gp = new goupiao();
if (gp.ShowDialog() == DialogResult.OK)
{
}
this.Visible = true;
}
catch (Exception e2)
{
MessageBox.Show(e2.Message);
}
}
private void 查询ToolStripMenuItem_Click_1(object sender, EventArgs e)
{
this.Visible = false;
try
{
chaxun cx = new chaxun();
if (cx.ShowDialog() == DialogResult.OK)
{
}
this.Visible = true;
}
catch (Exception e2)
{
MessageBox.Show(e2.Message);
}
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void 增加ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Visible = false;
try
{
zengjia zj = new zengjia();
if (zj.ShowDialog() == DialogResult.OK)
{
}
this.Visible = true;
}
catch (Exception e2)
{
MessageBox.Show(e2.Message);
}
}
private void 删除ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Visible = false;
try
{
shanchu sc= new shanchu();
if (sc.ShowDialog() == DialogResult.OK)
{
}
this.Visible = true;
}
catch (Exception e2)
{
MessageBox.Show(e2.Message);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -