📄 contact customer.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 民航订票管理系统.Airport_Work
{
public partial class Contact_Customer : Form
{
#region 用户自定义变量
/// <summary>
/// 自定义变量
/// </summary>
private string strconn = "";
private SqlCommand command;
private SqlConnection conn;
private DataSet ds = new DataSet();//数据集
private SqlDataAdapter SqlDA;
private CurrencyManager cmOrders;//数据导航
#endregion
public Contact_Customer()
{
InitializeComponent();
}
private void Close_button_Click(object sender, EventArgs e)
{
this.Close();
}
/// <summary>
/// 重载构造函数
/// </summary>
/// <param name="stringConnection"></param>
public Contact_Customer(string stringConnection)
{
InitializeComponent();
strconn = stringConnection;
}
private void Sousuo_button_Click(object sender, EventArgs e)
{
conn = new SqlConnection(strconn);
if (this.textBox1.Text.Trim() != "")
{
string mySqlstring = "SELECT Name,Phone FROM Customer WHERE CusID=(SELECT CusID FROM BookTicket WHERE FlyID='"+ textBox1.Text +"')";
command = new SqlCommand(mySqlstring, conn);
command.CommandType = CommandType.Text;
SqlDA = new SqlDataAdapter();
SqlDA.SelectCommand = command;
this.ds.Clear();
SqlDA.Fill(ds, "Name,Phone");
this.dataGrid1.SetDataBinding(ds, "Name,Phone");
cmOrders = (CurrencyManager)BindingContext[ds, "Name,Phone"];
}
else
{
MessageBox.Show("请输入航班编号", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
conn.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -