数组排序c#资源共享
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 TestA { public partial class LoginForm : Form { public LoginForm() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void btnLogin_Click(object sender, EventArgs e) { // 数据库连接字符串 string connString = "Data Source=A60361\\SQL2005;Initial Catalog=MySchool;User ID=sa;Pwd=111111"; // 创建 Connection 对象 SqlConnection connection = new SqlConnection(connString); // 打开数据库连接 connection.Open(); MessageBox.Show("打开数据库连接成功"); string sqlString = "select count(*) from student where loginid='" + this.tbLoginName.Text.Trim() + "' and loginpwd='" + this.tbLoginPwd.Text.Trim() + "'"; SqlCommand command = new SqlCommand(sqlString, connection); int num = (int)command.ExecuteScalar(); if (num == 1) { MessageBox.Show(this.tbLoginName.Text.Trim() + "登录成功!"); } else { MessageBox.Show(this.tbLoginName.Text.Trim() + "登录失败!请注册后再试!"); } // 关闭数据库连接 connection.Close(); //MessageBox.Show("关闭数据库连接成功"); } } }
- 1
- 粉丝: 1
- 资源: 1
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助