📄 ado.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlClient;
namespace Myschool
{
//数据库连接
class Ado
{
private static SqlCommand comm = null;
//建立连接
public static bool select(string name,string pwd) {
int num = 0;
try
{
Connect.conn.Open();//打开连接
comm = Connect.conn.CreateCommand();
comm.CommandText = string.Format("select count(*) from sudent where loginid='{0}' and loginpwd='{1}'", name, pwd);
num = Convert.ToInt32(comm.ExecuteScalar());
}
catch (Exception es)
{
Console.WriteLine(es.Message);
}
finally {
Connect.conn.Close();
}
if (num > 0)
{
return true;
}
else
{
return false;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -