資源簡介
做的很簡單。但是大家可以依據(jù)里面的主要代碼進(jìn)行修改,那樣就能基本實(shí)現(xiàn)你想要的效果了!

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
using?System.Data.OleDb;
namespace?dl
{
????public?partial?class?Form1?:?Form
????{
????????DataSet?ds;
????????int?maxNum;
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????OleDbConnectionStringBuilder?connectStringBuilder?=?new?OleDbConnectionStringBuilder();
????????????connectStringBuilder.DataSource?=?Application.StartupPath.ToString()?+?“\\dl.mdb“;
????????????connectStringBuilder.Provider?=?“Microsoft.Jet.OLEDB.4.0“;
????????????OleDbConnection?myOleDbConnection?=?new?OleDbConnection(connectStringBuilder.ConnectionString);
????????????myOleDbConnection.Open();
????????????OleDbCommand?cm?=?new?OleDbCommand(“select?*?from?dl?where?name=‘“?+?txtUserName.Text?+?“‘?and?password=‘“?+?txtPassWord.Text?+?“‘“?myOleDbConnection);
????????????OleDbDataReader?ra=cm.ExecuteReader?();
????????????if?(ra.HasRows)
????????????{
????????????????MessageBox.Show(“登入成功!“);
????????????}
????????????else
????????????{
????????????????MessageBox.Show(“用戶不存在,請檢測用戶名和密碼是否正確!“);
????????????}
????????????//OleDbDataAdapter?da?=?new?OleDbDataAdapter(cm);
????????????//ds?=?new?DataSet();
????????????//myOleDbConnection.Open();
????????????//int?numberOfRows?=?da.Fill(ds?“dl“);
????????????//myOleDbConnection.Close();
????????????//maxNum?=?ds.Tables[“dl“].Rows.Count;
????????????//if?(maxNum?==?1)//如果數(shù)據(jù)中沒有記錄或有多條記錄則抱錯(cuò)?
????????????//{
????????????//????MessageBox.Show(“登入成功!“);
????????????//}
????????????//else
????????????//{
????????????//????MessageBox.Show(“用戶不存在,請檢測用戶名和密碼是否正確!“);
????????????//}
????????}
????}
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????5612??2008-12-04?08:56??dl\dl\Properties\Resources.resx
?????文件????????249??2008-12-04?08:56??dl\dl\Properties\Settings.settings
?????文件???????1162??2008-12-04?08:56??dl\dl\Properties\AssemblyInfo.cs
?????文件???????2858??2008-12-04?08:56??dl\dl\Properties\Resources.Designer.cs
?????文件???????1085??2008-12-04?08:56??dl\dl\Properties\Settings.Designer.cs
?????目錄??????????0??2008-12-04?08:56??dl\dl\Properties
?????文件???????3211??2008-12-04?08:58??dl\dl\dl.csproj
?????文件???????5632??2005-11-11?22:25??dl\dl\bin\Debug\dl.vshost.exe
?????文件??????20480??2008-12-04?10:24??dl\dl\bin\Debug\dl.exe
?????文件??????19968??2008-12-04?10:24??dl\dl\bin\Debug\dl.pdb
?????文件?????147456??2008-12-04?08:54??dl\dl\bin\Debug\dl.mdb
?????目錄??????????0??2008-12-04?08:56??dl\dl\bin\Debug
?????目錄??????????0??2008-12-04?08:56??dl\dl\bin
?????目錄??????????0??2008-12-04?08:56??dl\dl\obj\Debug\TempPE
?????文件????????180??2008-12-04?09:58??dl\dl\obj\Debug\dl.Form1.resources
?????文件????????180??2008-12-04?08:58??dl\dl\obj\Debug\dl.Properties.Resources.resources
?????文件??????20480??2008-12-04?10:24??dl\dl\obj\Debug\dl.exe
?????文件????????842??2008-12-04?09:58??dl\dl\obj\Debug\dl.csproj.GenerateResource.Cache
?????文件??????19968??2008-12-04?10:24??dl\dl\obj\Debug\dl.pdb
?????目錄??????????0??2008-12-04?08:56??dl\dl\obj\Debug
?????文件????????233??2008-12-04?10:24??dl\dl\obj\dl.csproj.FileList.txt
?????目錄??????????0??2008-12-04?08:56??dl\dl\obj
?????文件????????461??2008-12-04?08:56??dl\dl\Program.cs
?????文件???????4057??2008-12-04?09:58??dl\dl\Form1.Designer.cs
?????文件???????5814??2008-12-04?09:58??dl\dl\Form1.resx
?????文件???????1935??2008-12-04?10:24??dl\dl\Form1.cs
?????目錄??????????0??2008-12-04?08:56??dl\dl
?????文件????????895??2008-12-04?08:56??dl\dl.sln
????..A..H.?????11776??2008-12-04?10:24??dl\dl.suo
?????目錄??????????0??2008-12-04?08:56??dl
............此處省略3個(gè)文件信息
評論
共有 條評論