using Models; using SqlDbHelper; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Reflection.Emit; using System.Text; using System.Threading.Tasks;
namespace DAL { publicclassNiceDAL { public List<NiceModel> GetTablelist() { stringsqlStr="select * from PZ "; DataTablesTable= NiceDB.GetDataTable(sqlStr, null); List<NiceModel> tableList = newList<NiceModel>(); foreach (DataRow dr in sTable.Rows) { NiceModeltb=newNiceModel(); tb.学号 = (dr["Num"].ToString()); tb.姓名 = (dr["Name"].ToString()); tb.班级 = (dr["Class"].ToString()); tb.QQ = (dr["QQ"].ToString()); tb.微信 = (dr["Wx"].ToString()); tableList.Add(tb); } return tableList; } } }
#Model 下 NiceModel.cs文件代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace Models { publicclassNiceModel { public string 姓名 { set; get; } public string 学号 { set; get; } public string 班级 { set; get; } public string QQ { set; get; } public string 微信 { set; get; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Configuration; using System.Data; using MySql.Data.MySqlClient;
using BLL; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;
namespace NiceHanForm { public partial classNiceHanForm : Form { publicNiceHanForm() { InitializeComponent(); }