Form2.cs
(开头部分) 9KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace 酒店管理
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void showxcInfo(string sqlStr)
{
//创建连接
SqlConnection con = new SqlConnection(DBHelper.conStr);
//打开连接
con.Open();
//创建命令对象
SqlCommand cmd = new SqlCommand(sqlStr, con);
//执行命令对象
SqlDataReader dr = cmd.ExecuteReader();
//清除信息
this.listView1.Items.Clear();
//循环读取信息
if (dr.HasRows)
{
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr[1].ToString());
item.SubItems.Add(dr[2].ToString());
item.SubItems.Add(dr[3].ToString());
item.SubItems.Add(dr[4].ToString());
item.SubItems.Add(dr[5].ToString());
item.Tag = dr[0];
this.listView1.Items.Add(item);
}
dr.Close();
}
//关闭连接
con.Close();
}
private void button1_Click(object sender, EventArgs e)
{
//收集信息
string cxname = this.textBox1.Text;
//模糊查询
if(cxname=="")
{
string sqlStr = "select * from RoomType";
showxcInfo(sqlStr);
后面还有 218 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
