📄 pasform.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 xlsb
{
public partial class pasform : Form
{
public pasform()
{
InitializeComponent();
}
private void pasform_Load(object sender, EventArgs e)
{
textBox2.Text = DateTime.Today.ToShortDateString();
SqlConnection myConnection = new SqlConnection("Data Source=" + main.servername + ";Initial Catalog="+main.dbname+";Persist Security Info=True;User ID=" + main.saname + ";Password=" +main.pass);
string SQL_Select = "select md_username from userinfo";
SqlCommand myCommand = new SqlCommand(SQL_Select, myConnection); //创建一个SqlCommand
myCommand.Connection.Open(); //读取数据记录并绑定
SqlDataReader myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection); //使用DataReader读取速度更快
while (myReader.Read())
{
comboBox1.Items.Add(myReader["MD_UserName"].ToString().TrimEnd());//循环赋值
}
if (comboBox1.Items.Count != 0)
comboBox1.SelectedIndex =0;
myCommand.Connection.Close();
}
private void button1_Click(object sender, EventArgs e)
{
main newmain = new main();
newmain.Show();
main.pMainWin.toolStripStatusLabel2.Text = comboBox1.Text;
this.Close();
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -