110,566
社区成员
发帖
与我相关
我的任务
分享
主界面
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace frmMain
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
#region 调用出手机信息维护系统
private void ToolStripMenuItem_Click_1(object sender, EventArgs e)
{
mobileInfoVindicate mobileinfovindicate = new mobileInfoVindicate();
mobileinfovindicate.Show();
//
mobileinfovindicate.MdiParent = this;
}
#endregion
#region 退出系统
private void tsdbt_Exit_Click(object sender, EventArgs e)
{
DialogResult result = MessageBox.Show("你确定要退出本程序吗?", "提示!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
this.Close();
}
}
#endregion
}
}
子窗体里的功能
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace frmMain
{
public partial class mobileInfoVindicate : Form
{
public mobileInfoVindicate()
{
InitializeComponent();
}
/// <summary>
/// 单击搜索所出来的数据
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void blb_Beat_Click(object sender, EventArgs e)
{
const string sql = "Data Source=.;Initial Catalog=MobileDB;User Id=sa;Pwd=sasa";
SqlConnection conn = new SqlConnection(sql);
string sqlOne = string.Format("select * from Mobile where Brand like'%{0}%'", txt_Input.Text);
SqlCommand comm = new SqlCommand(sqlOne, conn);
DataSet dst = new DataSet("MobileDB");
SqlDataAdapter dataa = new SqlDataAdapter(comm);
dataa.Fill(dst, "MobileInfo");
dtgv_Tools.DataSource = dst.Tables["MobileInfo"];
}
#region 退出手机维护界面
private void tsdbt_Exit_Click_1(object sender, EventArgs e)
{
DialogResult result = MessageBox.Show("确定要退出界面吗?", "aa", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
this.Close();
}
}
#endregion
}
}