QQ基本代码

这是一个使用C#编写的QQ登录窗体应用,包含了初始化组件、QQ号码和密码验证、图片加载、数据库操作以及登录状态检查等功能。代码在文本框内容改变时会根据QQ号码查询用户头像,并在登录时检查账号密码的正确性以及登录状态。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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;
using MyQQ;
namespace qq
{
    public partial class LoginFrm : Form
    {
        public LoginFrm()
        {
            InitializeComponent();
        }
        //窗体加载时
        private void LoginFrm_Load(object sender, EventArgs e)
        {
            this.picFace.Image = this.imageFace.Images[0];
        }
        //文本框改变时发生的窗体
        private void txtNum_TextChanged(object sender, EventArgs e)
        {
            if (this.txtNum.Text.Trim().Length == 5)
            {
                this.txtPwd.Focus();
                string sql = string.Format("select FaceId from Users where Id = {0}", this.txtNum.Text);
                SqlCommand cmd = new SqlCommand(sql, DbHelper.conn);
                try
                {
                    DbHelper.opendb();
                    this.picFace.Image = this.imageFace.Images[Convert.ToInt32(cmd.ExecuteScalar())];
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                finally
                {
       
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值