資源簡介
這是我們的畢業項目,付出了不少汗水~~
如有不足之處,希望大家能見諒,謝謝

代碼片段和文件信息
using?System;
using?System.Collections;
using?System.Collections.Specialized;
using?System.Data;
using?System.Data.SqlClient;
using?System.Configuration;
namespace?Tel.SQLServerDAL?//可以修改成實際項目的命名空間名稱
{
///?
///?Copyright?(C)?2004-2008?LiTianPing?
///?數據訪問基礎類(基于SQLServer)
///?用戶可以修改滿足自己項目的需要。
///?
public?abstract?class?DbHelperSQL
{
//數據庫連接字符串(web.config來配置)
//se=DATAbase;uid=sa;pwd=“?/>
protected?static?string?connectionString?=?“server=127.0.0.1;database=MobileTelephone;Trusted_connection=true“;
public?DbHelperSQL()
{
}
#region?公用方法
public?static?int?GetMaxID(string?FieldNamestring?TableName)
{
string?strsql?=?“select?max(“?+?FieldName?+?“)+1?from?“?+?TableName;
object?obj?=?GetSingle(strsql);
if?(obj?==?null)
{
return?1;
}
else
{
return?int.Parse(obj.ToString());
}
}
public?static?bool?Exists(string?strSql?params?SqlParameter[]?cmdParms)
{
object?obj?=?GetSingle(strSql?cmdParms);
int?cmdresult;
if?((object.Equals(obj?null))?||?(object.Equals(obj?System.DBNull.Value)))
{
cmdresult?=?0;
}
else
{
cmdresult?=?int.Parse(obj.ToString());
}
if?(cmdresult?==?0)
{
return?false;
}
else
{
return?true;
}
}
#endregion
#region??執行簡單SQL語句
///?
///?執行SQL語句,返回影響的記錄數
///?
///?SQL語句
///?影響的記錄數
public?static?int?ExecuteSql(string?SQLString)
{
using?(SqlConnection?connection?=?new?SqlConnection(connectionString))
{
using?(SqlCommand?cmd?=?new?SqlCommand(SQLStringconnection))
{
try
{
connection.Open();
int?rows=cmd.ExecuteNonQuery();
return?rows;
}
catch(System.Data.SqlClient.SqlException?E)
{
connection.Close();
throw?new?Exception(E.Message);
}
}
}
}
///?
///?執行多條SQL語句,實現數據庫事務。
///?
///?多條SQL語句
public?static?void?ExecuteSqlTran(ArrayList?SQLStringList)
{
using?(SqlConnection?conn?=?new?SqlConnection(connectionString))
{
conn.Open();
SqlCommand?cmd?=?new?SqlCommand();
cmd.Connection=conn;
SqlTransaction?tx=conn.BeginTransaction();
cmd.Transaction=tx;
try
{???
for(int?n=0;n {
string?strsql=SQLStringList[n].ToString();
if?(strsql.Trim().Length>1)
{
cmd.CommandText=strsql;
cmd.ExecuteNonQuery();
}
}
tx.Commit();
}
catch(System.Data.SqlClient.SqlException?E)
{
tx.Rollback();
throw?new?Exception(E.Message);
}
}
}
///?
///?執行帶一個存儲過程參數的的SQL語句。
///?
///?SQL語句
///?參數內容比如一個字段是格式復雜的文章,有特殊符號,可以通過這個方式添加
///?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1859??2008-06-26?13:28??MobileTelephone\BLL\AssemblyInfo.cs
?????文件???????1525??2008-06-30?01:38??MobileTelephone\BLL\asslevel.cs
?????文件???????1743??2008-06-30?16:48??MobileTelephone\BLL\associator.cs
?????文件?????650752??2008-07-02?15:13??MobileTelephone\BLL\bin\Debug\BLL.pdb
?????文件?????118784??2008-07-02?15:13??MobileTelephone\BLL\bin\Debug\DAL.dll
?????文件?????724480??2008-07-02?15:13??MobileTelephone\BLL\bin\Debug\DAL.pdb
?????文件??????40960??2008-07-02?15:13??MobileTelephone\BLL\bin\Debug\Model.dll
?????文件??????36864??2008-07-02?15:13??MobileTelephone\BLL\bin\Debug\BLL.dll
?????文件?????663040??2008-07-02?15:13??MobileTelephone\BLL\bin\Debug\Model.pdb
?????文件???????9125??2008-06-30?16:48??MobileTelephone\BLL\BLL.csproj
?????文件???????1805??2008-07-02?15:44??MobileTelephone\BLL\BLL.csproj.user
?????文件???????1301??2008-06-26?13:28??MobileTelephone\BLL\client.cs
?????文件???????1293??2008-06-26?13:28??MobileTelephone\BLL\color.cs
?????文件???????1285??2008-06-26?13:28??MobileTelephone\BLL\duty.cs
?????文件???????1519??2008-06-29?02:06??MobileTelephone\BLL\employee.cs
?????文件???????1327??2008-06-30?02:24??MobileTelephone\BLL\gathering.cs
?????文件???????1307??2008-06-26?13:28??MobileTelephone\BLL\ICType.cs
?????文件???????1721??2008-07-02?14:29??MobileTelephone\BLL\identityCard.cs
?????文件???????1341??2008-06-26?13:28??MobileTelephone\BLL\mainmenu.cs
?????文件???????1636??2008-06-26?13:28??MobileTelephone\BLL\merchandise.cs
?????文件???????1474??2008-06-26?13:28??MobileTelephone\BLL\merchandiseType.cs
????.......????650752??2008-07-02?15:13??MobileTelephone\BLL\obj\Debug\BLL.pdb
????..A..H.?????96392??2008-07-02?15:44??MobileTelephone\BLL\obj\Debug\BLL.projdata
????.......?????36864??2008-07-02?15:13??MobileTelephone\BLL\obj\Debug\BLL.dll
?????文件???????1509??2008-06-29?18:28??MobileTelephone\BLL\operate.cs
?????文件???????1325??2008-06-26?13:28??MobileTelephone\BLL\orderType.cs
?????文件???????1309??2008-06-30?15:07??MobileTelephone\BLL\payment.cs
?????文件???????1441??2008-06-26?13:28??MobileTelephone\BLL\pointSet.cs
?????文件???????1309??2008-06-26?13:28??MobileTelephone\BLL\popedom.cs
?????文件???????1485??2008-06-26?13:28??MobileTelephone\BLL\popedom_list.cs
............此處省略271個文件信息
- 上一篇:winbugs14:層次貝葉斯建模軟件
- 下一篇:FPGA應用電阻電容自動測量系統
評論
共有 條評論