資源簡介
c#課程設計-模仿手機通訊錄,代碼齊全,內容完整。附帶設計報告
代碼片段和文件信息
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;
using?System.IO;
using?System.Data.OleDb;
namespace?PhoneBook1506041K
{
????class?Database
????{
??????//public???OleDbDataReader?oleread_k;
??????//?public??Image?im;
????????public?int?N_Ogy;??//數據庫中的記錄條數
?????//?public???OleDbCommand?olecom_k1;
????????public?OleDbDataReader?oleread_Ogy;
????????public?OleDbConnection?objConnection;??//連接數據庫對象
????????//連接數據庫
????????public?bool?link(string?fstring?s)
????????{
????????????string?a?=?s?+?“.mdb“;
????????????string?strcon?=?“Provider?=“+f+“;“+“Data?Source=“+a;
????????????try
????????????{
????????????????objConnection?=?new?OleDbConnection(strcon);
????????????????objConnection.Open();
????????????????return?true;
????????????}
????????????catch?{?return?false;?}
????????}
????????public?string?linkfile_f()
????????{
????????????string[]?readFile;
????????????string[]?fuwuqi;
???????????
????????????//?olecom_k1?=?new?OleDbCommand(“select?*?from?PhoneBook1506041K?“?objConnection);
????????????readFile?=?File.ReadAllLines(“PhoneBook1506041K.txt“?Encoding.Default);
????????????string?fuwuqiL?=?readFile[0];??????????
????????????fuwuqi?=?fuwuqiL.Split(‘‘);???????????
????????????return?fuwuqi[0];
????????
????????}
????????public?string?linkfile_s()
????????{
????????????string[]?readFile;
???????????
????????????string[]?shujuku;
????????????//?olecom_k1?=?new?OleDbCommand(“select?*?from?PhoneBook1506041K?“?objConnection);
????????????readFile?=?File.ReadAllLines(“PhoneBook1506041K.txt“?Encoding.Default);
????????????string?shujukuL?=?readFile[1];???????????
????????????shujuku?=?shujukuL.Split(‘‘);
????????????return?shujuku[0]?;
????????}
????????//獲取數據庫里面的記錄數目
????????public?void?Datanumber()
????????{
????????????//objConnection?=?new?OleDbConnection(strcon);
????????????//objConnection.Open();
????????????OleDbCommand?sol?=?new?OleDbCommand(“select?*?from?PhoneBook1506041K?“?objConnection);
????????????string?sql?=?“select?*?from?PhoneBook1506041K“;
????????????OleDbDataAdapter?myda?=?new?OleDbDataAdapter(sql?objConnection);
????????????DataSet?myds?=?new?DataSet();
????????????myda.Fill(myds?“PhoneBook1506041K“);
????????????oleread_Ogy?=?sol.ExecuteReader();
????????????string?str?=?“select?count(1)?from?PhoneBook1506041K“;
????????????OleDbDataAdapter?jisu?=?new?OleDbDataAdapter(str?objConnection);
????????????DataSet?myds1?=?new?DataSet();
????????????jisu.Fill(myds1);
????????????N_Ogy??=?Convert.ToInt32(myds1.Tables[0].Rows[0][0].ToString());
????????}
????????//public?void?SaveImages(string?filepathOleDbConnection?conn)
????????//{
????????//????FileStream?fs?=?File?.Open?(filepath?FileMode.Open);
????????//????BinaryReader?br?=?new?BinaryReader(fs);
????????//????byte[]?b
- 上一篇:C#在線答題系統 純代碼編寫
- 下一篇:C#使用POP3協議構建客戶端郵件接收源代碼
評論
共有 條評論