三层架构中 textBox显示数据库的内容 代码
展开全部
UI层:
public void SearchStu()
{
StudentInfo studentinfo = StuSyBLL.StuManageBLL.SearchStuInfo();
lblSex.Text = "男";
if (studentinfo.s_Sex != true)
{
lblSex.Text = "女";
}
lblName.Text = studentinfo.s_Name;
lblStuNum.Text = studentinfo.s_StuNo;
lblNation.Text = studentinfo.s_Nation;
lblIdCard.Text = studentinfo.s_IdCard;
lblCome.Text = studentinfo.s_Birthplace;
lblBeginTime.Text = studentinfo.s_EntranTime.ToString();
lblBirthday.Text = studentinfo.s_Brithday.ToString();
}
你把Label 改成textbox的就OK了
BLL层:
public static StudentInfo SearchStuInfo()
{
string strSql = string.Format("select * from [StudentManage].[dbo].[StudentInfo] where s_StuNo='v094926421123'");
return StuSyDAL.StuManageDAL.SearchStuInfo(strSql);
}
DAL层:
public static StudentInfo SearchStuInfo(string strSql)
{
StudentInfo studentinfo = new StudentInfo();
SqlDataReader dr = SQLHelper.ExecuteReader(strSql);
while (dr.Read())
{
studentinfo.c_ID = int.Parse(dr["c_ID"].ToString());
studentinfo.s_Name = dr["s_Name"].ToString();
studentinfo.s_StuNo = dr["s_StuNo"].ToString();
studentinfo.s_Sex = Convert.ToBoolean(dr["s_Sex"]);
studentinfo.s_Brithday =Convert.ToDateTime(dr["s_Brithday"]);
studentinfo.s_Birthplace = dr["s_Birthplace"].ToString();
studentinfo.s_IdCard = dr["s_IdCard"].ToString();
studentinfo.s_Nation = dr["s_Nation"].ToString();
studentinfo.s_EntranTime = Convert.ToDateTime(dr["s_EntranTime"]);
}
return studentinfo;
}
public void SearchStu()
{
StudentInfo studentinfo = StuSyBLL.StuManageBLL.SearchStuInfo();
lblSex.Text = "男";
if (studentinfo.s_Sex != true)
{
lblSex.Text = "女";
}
lblName.Text = studentinfo.s_Name;
lblStuNum.Text = studentinfo.s_StuNo;
lblNation.Text = studentinfo.s_Nation;
lblIdCard.Text = studentinfo.s_IdCard;
lblCome.Text = studentinfo.s_Birthplace;
lblBeginTime.Text = studentinfo.s_EntranTime.ToString();
lblBirthday.Text = studentinfo.s_Brithday.ToString();
}
你把Label 改成textbox的就OK了
BLL层:
public static StudentInfo SearchStuInfo()
{
string strSql = string.Format("select * from [StudentManage].[dbo].[StudentInfo] where s_StuNo='v094926421123'");
return StuSyDAL.StuManageDAL.SearchStuInfo(strSql);
}
DAL层:
public static StudentInfo SearchStuInfo(string strSql)
{
StudentInfo studentinfo = new StudentInfo();
SqlDataReader dr = SQLHelper.ExecuteReader(strSql);
while (dr.Read())
{
studentinfo.c_ID = int.Parse(dr["c_ID"].ToString());
studentinfo.s_Name = dr["s_Name"].ToString();
studentinfo.s_StuNo = dr["s_StuNo"].ToString();
studentinfo.s_Sex = Convert.ToBoolean(dr["s_Sex"]);
studentinfo.s_Brithday =Convert.ToDateTime(dr["s_Brithday"]);
studentinfo.s_Birthplace = dr["s_Birthplace"].ToString();
studentinfo.s_IdCard = dr["s_IdCard"].ToString();
studentinfo.s_Nation = dr["s_Nation"].ToString();
studentinfo.s_EntranTime = Convert.ToDateTime(dr["s_EntranTime"]);
}
return studentinfo;
}
光点科技
2023-08-15 广告
2023-08-15 广告
通常情况下,我们会按照结构模型把系统产生的数据分为三种类型:结构化数据、半结构化数据和非结构化数据。结构化数据,即行数据,是存储在数据库里,可以用二维表结构来逻辑表达实现的数据。最常见的就是数字数据和文本数据,它们可以某种标准格式存在于文件...
点击进入详情页
本回答由光点科技提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询