c#窗体通讯录
功能要求
实现增删查功能
制作步骤介绍
创建主页面
创建查询页面
实现搜索功能
搜索功能进阶(判断非空)
实现右键菜单删除功能
代码样式
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace QQ通讯录动态加载与删除
{
public partial class CardList : Form
{
//定义一个全局的连接对象的变量
SqlConnection conn = null;
public CardList()
{
InitializeComponent();
}
private void tsmiDelete_Click(object sender, EventArgs e)
{
//找到被选中的项
String QQnumber=lvCards.SelectedItems[0].SubItems[1].Text;
//要做的事情
String sql = String.Format("delete from QQCard where QQnumber={0}",QQnumber);
MessageBox.Show(sql);
//开启连接对象