using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
namespace ConsoleApplication1
{
class Program
{
private const string sql = "Data Source=.;Initial Catalog=MySchool;Integrated Security=True";
static void Main(string[] args)
{
Program p = new Program();
string s3 = "";
bool b = p.show("Admin", "0", ref s3);
if (b)
{
Console.WriteLine(s3);
}
else
{
Console.WriteLine(s3);
}
Console.ReadLine();
}
public bool show(string s1, string s2, ref string s3)
{
SqlConnection connection = new SqlConnection(sql);
try
{
con
C# 数据库 检查用户信息 验证登陆 十四章
最新推荐文章于 2022-07-26 14:06:55 发布
这是一个使用C#连接SQL Server数据库,检查并验证用户登录信息的示例。程序通过建立数据库连接,执行SQL查询来判断用户名和密码是否匹配,从而实现登录验证功能。
摘要由CSDN通过智能技术生成