cl_stuland_dal.cs
来自「用三层架构写的用户登录的简单例子 适合C#初学者」· CS 代码 · 共 44 行
CS
44 行
using System;
using System.Collections.Generic;
using System.Text;
using Model;
using System.Data;
namespace DAl
{
public class Cl_stuland_DAl
{
public void InsertDataset(Cl_stuland stu)
{
string sqlstr = "intsert into stuland(stuid,password)" +
"values('" + stu.Stuid.ToString() +"','" + stu.Password.ToString() +"')";
Conn MyConn = new Conn();
MyConn.DbConn();
MyConn.Dosql(sqlstr);
MyConn.CloseDB();
}
public bool SelectDataset(Cl_stuland stu)
{
string sqlstr = "select * from stuland where stuid = '" + stu.Stuid +"' and password = '"+ stu.Password +"'";
Conn MyConn = new Conn();
MyConn.DbConn();
DataTable dt = new DataTable();
dt = MyConn.Getdata(sqlstr);
MyConn.CloseDB();
if (dt.Rows.Count > 0)
{
return true;
}
else
{
return false;
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?