基于C#實(shí)現(xiàn)員工IC卡的讀寫功能
實(shí)踐過(guò)程
效果
代碼
public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { lblTime.Text = DateTime.Now.ToString();//當(dāng)進(jìn)行考勤的時(shí)候在窗體中顯示當(dāng)前時(shí)間 tsslTime.Text = DateTime.Now.ToString();//在任務(wù)欄中顯示當(dāng)前時(shí)間 } private void 添加員工ToolStripMenuItem_Click(object sender, EventArgs e) { Form2 frm2 = new Form2(); frm2.ShowDialog(); } private void 系統(tǒng)信息ToolStripMenuItem_Click(object sender, EventArgs e) { System.Diagnostics.Process.Start("MSINFO32.EXE"); } private void 開始考勤ToolStripMenuItem_Click(object sender, EventArgs e) { timer1.Start();//開始考勤 panel1.Visible = true;//顯示考勤界面 timer2.Start();//開始顯示當(dāng)前時(shí)間 開始考勤ToolStripMenuItem.Enabled = false;//禁用開始考勤菜單 } int flag = -1;//設(shè)置的一個(gè)變量,用于控制一張IC卡只讀取一次以及向數(shù)據(jù)庫(kù)中只添加一次內(nèi)容 int flag2 = -1;//設(shè)置的一個(gè)變量,用于控制當(dāng)某個(gè)IC卡已經(jīng)參加考勤后,彈出一次錯(cuò)誤提示 private void timer1_Tick(object sender, EventArgs e) { int i = baseClass.ReadIC(txtICCard);//調(diào)用公共類中的ReadIC方法開始循環(huán)讀取IC卡 if (i == -1)//如果返回值是-1說(shuō)明沒有IC卡 { //清空顯示員工信息的文本框 txtDept.Text = ""; txtFolk.Text = ""; txtICCard.Text = ""; txtJob.Text = ""; txtName.Text = ""; txtSex.Text = ""; groupBox1.Text = "考勤進(jìn)行中"; flag = -1;//初始化標(biāo)記 flag2 = -1;//初始化標(biāo)記 } else//如果有IC卡進(jìn)行考勤 { if (flag ==-1)//只有當(dāng)flag為-1的時(shí)候執(zhí)行 { string icID = txtICCard.Text.Trim();//獲取讀取的IC卡編號(hào) if (baseClass.isCheck(icID))//isCheck方法判斷是否參加過(guò)考勤 { if (flag2 == -1)//只有當(dāng)flag2為-1的時(shí)候執(zhí)行 { flag2 = 0;//改變標(biāo)記的值從而實(shí)現(xiàn)只彈出一次警告對(duì)話框 MessageBox.Show("已經(jīng)參加過(guò)考勤!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error); //清空文本框 txtDept.Text = ""; txtFolk.Text = ""; txtICCard.Text = ""; txtJob.Text = ""; txtName.Text = ""; txtSex.Text = ""; txtICCard.Text = ""; groupBox1.Text = "考勤進(jìn)行中"; } } else//如果沒有參加過(guò)考勤 { //調(diào)用GetInfo方法獲取IC卡對(duì)應(yīng)的員工信息 baseClass.GetInfo(txtICCard.Text.Trim(), txtName, txtSex, txtJob, txtFolk, txtDept, groupBox1); string name = txtName.Text.Trim();//員工姓名 string sex = txtSex.Text.Trim();//員工性別 string job = txtJob.Text.Trim();//員工職位 string folk = this.txtFolk.Text.Trim();//員工民族 string dept = txtDept.Text.Trim();//員工部門 //聲明一個(gè)字符串,用于存儲(chǔ)一條插入語(yǔ)句,實(shí)現(xiàn)將考勤信息插入到數(shù)據(jù)表中 string str = "insert into CheckNote(C_CardID,C_Name,C_Sex,C_Job,C_Folk,C_Dept,C_Time) values('" + icID + "','" + name + "','" + sex + "','" + job + "','" + folk + "','" + dept + "','" + DateTime.Now.ToShortDateString() + "')"; baseClass.ExecuteSQL(str);//ExecuteSQL方法執(zhí)行SQL語(yǔ)句 tsslEinfo.Text = "已經(jīng)有"+baseClass.GetNum(DateTime.Now.ToShortDateString())+"人參加考勤"; } } flag = 0;//改變flag的值實(shí)現(xiàn)一張IC卡只存儲(chǔ)一次信息 } } private void 退出系統(tǒng)ToolStripMenuItem_Click(object sender, EventArgs e) { Application.Exit(); } private void timer2_Tick(object sender, EventArgs e) { lblTime.Text = DateTime.Now.ToString(); } private void 考勤結(jié)束ToolStripMenuItem_Click(object sender, EventArgs e) { 開始考勤ToolStripMenuItem.Enabled = true; panel1.Visible = false; timer1.Stop(); timer2.Stop(); tsslEinfo.Text = ""; } private void 考勤記錄ToolStripMenuItem_Click(object sender, EventArgs e) { Form3 frm3 = new Form3(); frm3.ShowDialog(); } private void timer3_Tick(object sender, EventArgs e) { tsslTime.Text = DateTime.Now.ToString(); } private void 關(guān)于ToolStripMenuItem_Click(object sender, EventArgs e) { AboutBox1 ab = new AboutBox1(); ab.ShowDialog(); } }
public partial class Form2 : Form { public Form2() { InitializeComponent(); } private void button2_Click(object sender, EventArgs e) { this.Close(); } private void Form2_Load(object sender, EventArgs e) { cbFolk.SelectedIndex = 0;//民族選項(xiàng)默認(rèn)第一項(xiàng)被選中 cbSex.SelectedIndex = 0;//性別選項(xiàng)默認(rèn)第一項(xiàng)被選中 } private void button1_Click(object sender, EventArgs e) { if (txtDept.Text == "" || txtICCard.Text == "" || txtJob.Text == "" || txtName.Text == "") { MessageBox.Show("請(qǐng)將信息輸入完整!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string icID = txtICCard.Text.Trim();//要寫入IC卡的數(shù)據(jù) string name = txtName.Text.Trim();//員工姓名 string sex = cbSex.Text.Trim();//員工性別 string job = txtJob.Text.Trim();//員工職位 string folk= cbFolk.Text.Trim();//員工民族 string dept = txtDept.Text.Trim();//員工部門 if (baseClass.CheckID(icID))//CheckID方法檢查編號(hào)是否存在 { MessageBox.Show("IC卡編號(hào)已經(jīng)存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (baseClass.WriteIC(icID) == 0)//WriteIC方法將編號(hào)寫入IC卡,如果成功則返回0 { //聲明一條語(yǔ)句,用于將員工其他信息插入到數(shù)據(jù)表中 string strSQL = "insert into Employee(CardID,E_Name,E_Sex,E_Job,E_Folk,E_Dept,E_Time) values('" + icID + "','" + name + "','" + sex + "','" + job + "','" + folk + "','" + dept + "','"+DateTime.Now.ToShortDateString()+"')"; if (baseClass.ExecuteSQL(strSQL))//ExecuteSQL方法執(zhí)行這條語(yǔ)句 { MessageBox.Show("IC卡注冊(cè)完畢!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } } private void txtICCard_TextChanged(object sender, EventArgs e) { if (Regex.IsMatch(txtICCard.Text.Trim(), "[\u4e00-\u9fa5]")) { MessageBox.Show("禁止輸入漢字!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
#region 使用動(dòng)態(tài)鏈接庫(kù),聲明方法 [StructLayout(LayoutKind.Sequential)] public unsafe class IC { //對(duì)設(shè)備進(jìn)行初始化 [DllImport("Mwic_32.dll", EntryPoint = "auto_init", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] public static extern int auto_init(int port, int baud); //設(shè)備密碼格式 [DllImport("Mwic_32.dll", EntryPoint = "setsc_md", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] public static extern int setsc_md(int icdev, int mode); //獲取設(shè)備當(dāng)前狀態(tài) [DllImport("Mwic_32.dll", EntryPoint = "get_status", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] public static extern Int16 get_status(int icdev, Int16* state); //關(guān)閉設(shè)備通訊接口 [DllImport("Mwic_32.dll", EntryPoint = "ic_exit", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] public static extern int ic_exit(int icdev); //使設(shè)備發(fā)出蜂鳴聲 [DllImport("Mwic_32.dll", EntryPoint = "dv_beep", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] public static extern int dv_beep(int icdev, int time); //向IC卡中寫數(shù)據(jù) [DllImport("Mwic_32.dll", EntryPoint = "swr_4442", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] public static extern int swr_4442(int icdev, int offset, int len, char* w_string); //讀取IC卡中數(shù)據(jù) [DllImport("Mwic_32.dll", EntryPoint = "srd_4442", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] public static extern int srd_4442(int icdev, int offset, int len, char* r_string); //核對(duì)卡密碼 [DllImport("Mwic_32.dll", EntryPoint = "csc_4442", SetLastError = true, CharSet = CharSet.Auto, ExactSpelling = true, CallingConvention = CallingConvention.Winapi)] public static extern Int16 Csc_4442(int icdev, int len, [MarshalAs(UnmanagedType.LPArray)] byte[] p_string); } #endregion class baseClass { public static int WriteIC(string id)//寫入IC卡的方法 { int flag = -1; //初始化 int icdev = IC.auto_init(0, 9600); if (icdev < 0) MessageBox.Show("端口初始化失敗,請(qǐng)檢查接口線是否連接正確。", "錯(cuò)誤提示", MessageBoxButtons.OK, MessageBoxIcon.Information); int md = IC.setsc_md(icdev, 1); //設(shè)備密碼格式 unsafe { Int16 status = 0; Int16 result = 0; result = IC.get_status(icdev, &status); if (result != 0) { MessageBox.Show("設(shè)備當(dāng)前狀態(tài)錯(cuò)誤!"); int d1 = IC.ic_exit(icdev); //關(guān)閉設(shè)備 } if (status != 1) { MessageBox.Show("請(qǐng)插入IC卡"); int d2 = IC.ic_exit(icdev); //關(guān)閉設(shè)備 } } unsafe { //卡的密碼默認(rèn)為6個(gè)F(密碼為:ffffff),1個(gè)F的16進(jìn)制是15,2個(gè)F的16進(jìn)制是255。 byte[] pwd = new byte[3] { 0xff, 0xff, 0xff }; Int16 checkIC_pwd = IC.Csc_4442(icdev, 3, pwd); if (checkIC_pwd < 0) { MessageBox.Show("IC卡密碼錯(cuò)誤!"); } char str = 'a'; int write = -1; for (int j = 0; j < id.Length; j++) { str = Convert.ToChar(id.Substring(j, 1)); write = IC.swr_4442(icdev, 33 + j, id.Length, &str); } if (write == 0) { flag = write; int beep = IC.dv_beep(icdev, 20); //發(fā)出蜂鳴聲 } else MessageBox.Show("數(shù)據(jù)寫入IC卡失敗!"); } int d = IC.ic_exit(icdev); //關(guān)閉設(shè)備 return flag; } public static int ff = -1; public static int ReadIC(TextBox tb)//讀取IC卡 { int flag = -1; //初始化 int icdev = IC.auto_init(0, 9600); if (icdev < 0) MessageBox.Show("端口初始化失敗,請(qǐng)檢查接口線是否連接正確。", "錯(cuò)誤提示", MessageBoxButtons.OK, MessageBoxIcon.Information); int md = IC.setsc_md(icdev, 1); //設(shè)備密碼格式 unsafe { Int16 status = 0; Int16 result = 0; result = IC.get_status(icdev, &status); if (result != 0) { MessageBox.Show("設(shè)備當(dāng)前狀態(tài)錯(cuò)誤!"); int d1 = IC.ic_exit(icdev); //關(guān)閉設(shè)備 } if (status != 1) { ff = -1; int d2 = IC.ic_exit(icdev); //關(guān)閉設(shè)備 } } unsafe { char str; int read = -1; string ic = ""; for (int j = 0; j < 6; j++) { read = IC.srd_4442(icdev, 33 + j, 1, &str); ic = ic + Convert.ToString(str); } tb.Text = ic; if (ff == -1) { int i = IC.dv_beep(icdev, 10); //發(fā)出蜂鳴聲 } if (read == 0) { ff = 0; flag = read; } } int d = IC.ic_exit(icdev); //關(guān)閉設(shè)備 return flag; } public static bool ExecuteSQL(string sql)//執(zhí)行SQL語(yǔ)句 { bool flag = false; string strg = Application.StartupPath.ToString(); strg = strg.Substring(0, strg.LastIndexOf("\\")); strg = strg.Substring(0, strg.LastIndexOf("\\")); strg += @"\db1.mdb"; OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" + strg); conn.Open(); OleDbCommand cmd = new OleDbCommand(sql, conn); int i = cmd.ExecuteNonQuery(); if (i > 0) { flag = true; conn.Close(); } return flag; } public static bool CheckID(string id)//判斷輸入的IC卡號(hào)是否已經(jīng)存在 { bool flag = false; string strg = Application.StartupPath.ToString(); strg = strg.Substring(0, strg.LastIndexOf("\\")); strg = strg.Substring(0, strg.LastIndexOf("\\")); strg += @"\db1.mdb"; OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" + strg); conn.Open(); OleDbCommand cmd = new OleDbCommand("select Count(*) from Employee where CardID='"+id+"'", conn); int i = Convert.ToInt32(cmd.ExecuteScalar()); conn.Close(); if (i > 0) { flag = true; } return flag; } public static void GetInfo(string id,TextBox name,TextBox sex,TextBox job,TextBox folk,TextBox dept,GroupBox gb)//根據(jù)IC卡號(hào)獲取相應(yīng)的信息 { if (CheckID(id)) { string strg = Application.StartupPath.ToString(); strg = strg.Substring(0, strg.LastIndexOf("\\")); strg = strg.Substring(0, strg.LastIndexOf("\\")); strg += @"\db1.mdb"; OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" + strg); conn.Open(); OleDbCommand cmd = new OleDbCommand("select * from Employee where CardID='" + id + "'", conn); OleDbDataReader sdr = cmd.ExecuteReader(); sdr.Read(); name.Text = sdr["E_Name"].ToString(); sex.Text = sdr["E_Sex"].ToString(); job.Text = sdr["E_Job"].ToString(); folk.Text = sdr["E_Folk"].ToString(); dept.Text = sdr["E_Dept"].ToString(); gb.Text = "考勤進(jìn)行中(考勤成功)"; sdr.Close(); conn.Close(); } else { gb.Text = "考勤進(jìn)行中(此IC卡未被注冊(cè)?。?; } } public static void ExportData(DataGridView srcDgv, string fileName)//導(dǎo)出數(shù)據(jù),傳入一個(gè)datagridview和一個(gè)文件路徑 { string type = fileName.Substring(fileName.IndexOf(".") + 1);//獲得數(shù)據(jù)類型 if (type.Equals("xls", StringComparison.CurrentCultureIgnoreCase))//Excel文檔 { Excel.Application excel = new Excel.Application(); try { excel.DisplayAlerts = false; excel.Workbooks.Add(true); excel.Visible = false; for (int i = 0; i < srcDgv.Columns.Count; i++)//設(shè)置標(biāo)題 { excel.Cells[2, i + 1] = srcDgv.Columns[i].HeaderText; } for (int i = 0; i < srcDgv.Rows.Count; i++)//填充數(shù)據(jù) { for (int j = 0; j < srcDgv.Columns.Count; j++) { if (srcDgv[j, i].ValueType.ToString() == "System.Byte[]") { excel.Cells[i + 3, j + 1] = "System.Byte[]"; } else { excel.Cells[i + 3, j + 1] = srcDgv[j, i].Value; } } } excel.Workbooks[1].SaveCopyAs(fileName);//保存 } finally { excel.Quit(); } return; } //保存Word文件 if (type.Equals("doc", StringComparison.CurrentCultureIgnoreCase)) { object path = fileName; Object none = System.Reflection.Missing.Value; Word.Application wordApp = new Word.Application(); Word.Document document = wordApp.Documents.Add(ref none, ref none, ref none, ref none); //建立表格 Word.Table table = document.Tables.Add(document.Paragraphs.Last.Range, srcDgv.Rows.Count + 1, srcDgv.Columns.Count, ref none, ref none); try { for (int i = 0; i < srcDgv.Columns.Count; i++)//設(shè)置標(biāo)題 { table.Cell(1, i + 1).Range.Text = srcDgv.Columns[i].HeaderText; } for (int i = 0; i < srcDgv.Rows.Count; i++)//填充數(shù)據(jù) { for (int j = 0; j < srcDgv.Columns.Count; j++) { string a = srcDgv[j, i].ValueType.ToString(); if (a == "System.Byte[]") { PictureBox pp = new PictureBox(); byte[] pic = (byte[])(srcDgv[j, i].Value); //將數(shù)據(jù)庫(kù)中的圖片轉(zhuǎn)換成二進(jìn)制流 MemoryStream ms = new MemoryStream(pic); //將字節(jié)數(shù)組存入到二進(jìn)制流中 pp.Image = Image.FromStream(ms); //二進(jìn)制流Image控件中顯示 pp.Image.Save(@"C:\22.bmp"); //將圖片存入到指定的路徑 object aaa = table.Cell(i + 2, j + 1).Range; wordApp.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter; wordApp.Selection.InlineShapes.AddPicture(@"C:\22.bmp", ref none, ref none, ref aaa); pp.Dispose(); } else { table.Cell(i + 2, j + 1).Range.Text = srcDgv[j, i].Value.ToString(); } } } document.SaveAs(ref path, ref none, ref none, ref none, ref none, ref none, ref none, ref none, ref none, ref none, ref none); document.Close(ref none, ref none, ref none); if (File.Exists(@"C:\22.bmp")) { File.Delete(@"C:\22.bmp"); } } finally { wordApp.Quit(ref none, ref none, ref none); } } } public static void BinddataGridView(DataGridView dg, string datetime) { string strg = Application.StartupPath.ToString(); strg = strg.Substring(0, strg.LastIndexOf("\\")); strg = strg.Substring(0, strg.LastIndexOf("\\")); strg += @"\db1.mdb"; OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" + strg); conn.Open(); string str = "select C_CardID as IC卡編號(hào),C_Name as 員工姓名,C_Sex as 性別,C_Job as 職位,C_Folk as 民族,C_Dept as 員工部門,C_Time as 考勤日期 from CheckNote where C_Time='" + datetime + "'"; OleDbDataAdapter da = new OleDbDataAdapter(str, conn); System.Data.DataTable dt = new System.Data.DataTable(); da.Fill(dt); dg.DataSource = dt; dg.Columns[0].Width = 80; dg.Columns[1].Width = 80; dg.Columns[2].Width = 60; dg.Columns[3].Width = 60; dg.Columns[4].Width = 60; dg.Columns[5].Width = 80; dg.Columns[6].Width = 80; conn.Close(); } public static bool isCheck(string id)//檢查是否已經(jīng)參加過(guò)考勤 { bool flag = false; string strg = Application.StartupPath.ToString(); strg = strg.Substring(0, strg.LastIndexOf("\\")); strg = strg.Substring(0, strg.LastIndexOf("\\")); strg += @"\db1.mdb"; OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" + strg); conn.Open(); OleDbCommand cmd = new OleDbCommand("select Count(*) from CheckNote where C_CardID='" + id + "'", conn); int i = Convert.ToInt32(cmd.ExecuteScalar()); conn.Close(); if (i > 0) { flag = true; } return flag; } public static int GetNum(string datetime)//獲取所有參加考勤的人數(shù) { string strg = Application.StartupPath.ToString(); strg = strg.Substring(0, strg.LastIndexOf("\\")); strg = strg.Substring(0, strg.LastIndexOf("\\")); strg += @"\db1.mdb"; OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" + strg); conn.Open(); OleDbCommand cmd = new OleDbCommand("select Count(*) from CheckNote where C_Time='" + datetime + "'", conn); int i = Convert.ToInt32(cmd.ExecuteScalar()); conn.Close(); return i; } }
到此這篇關(guān)于基于C#實(shí)現(xiàn)員工IC卡的讀寫功能的文章就介紹到這了,更多相關(guān)C#讀寫員工IC卡內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
c#獲取季度時(shí)間實(shí)例代碼(季度的第一天)
這篇文章主要介紹了c#獲取季度時(shí)間:季度的第一天、季度的最后一天等功能,大家參考使用吧2013-12-12C#實(shí)現(xiàn)win10 uwp 右擊浮出窗在點(diǎn)擊位置
本文主要讓MenuFlyout出現(xiàn)在我們右擊位置。我們建一個(gè)ListView,然后綁定后臺(tái),在我們ListView要右擊顯示我們的浮出,要求我們的浮出在我們點(diǎn)擊位置2016-10-10C#獲取文件、文件夾和驅(qū)動(dòng)器的信息示例詳解
在C#中,文件、文件夾和驅(qū)動(dòng)器是文件系統(tǒng)操作的基本元素,了解如何獲取這些元素的信息對(duì)于開發(fā)文件處理和管理工具至關(guān)重要,本文將詳細(xì)介紹如何在C#中獲取有關(guān)文件、文件夾和驅(qū)動(dòng)器的信息,并提供相應(yīng)的示例,需要的朋友可以參考下2024-08-08C#給圖片加水印的簡(jiǎn)單實(shí)現(xiàn)方法
這篇文章主要介紹了C#給圖片加水印的簡(jiǎn)單實(shí)現(xiàn)方法,涉及C#操作圖片的相關(guān)技巧,非常具有實(shí)用價(jià)值,需要的朋友可以參考下2015-05-05C#窗口實(shí)現(xiàn)定時(shí)關(guān)機(jī)系統(tǒng)
這篇文章主要為大家詳細(xì)介紹了C#窗口實(shí)現(xiàn)定時(shí)關(guān)機(jī)系統(tǒng),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-07-07C#提取網(wǎng)頁(yè)中超鏈接link和text部分的方法
這篇文章主要介紹了C#提取網(wǎng)頁(yè)中超鏈接link和text部分的方法,涉及C#正則表達(dá)式及字符串操作相關(guān)技巧,需要的朋友可以參考下2016-02-02C#使用游標(biāo)實(shí)現(xiàn)補(bǔ)間函數(shù)
這篇文章主要為大家詳細(xì)介紹了C#使用游標(biāo)實(shí)現(xiàn)補(bǔ)間函數(shù),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2022-02-02VS2015為console.readkey添加代碼片段的方法
這篇文章主要介紹了VS2015為console.readkey添加代碼片段的方法,需要的朋友可以參考下2016-12-12C#從實(shí)體對(duì)象集合中導(dǎo)出Excel的代碼
數(shù)據(jù)的導(dǎo)出是項(xiàng)目中經(jīng)常要實(shí)現(xiàn)的功能,就拿最常見的要導(dǎo)出成Excel來(lái)說(shuō),網(wǎng)上看來(lái)看去,都是介紹從Datatable中導(dǎo)出2008-08-08