华拓科技网
您的当前位置:首页连接数据库方法

连接数据库方法

来源:华拓科技网
空间管理 您的位置: 宁广博客 » qyk的个人空间 » 日志

ASP.NET中的数据库操作类sqlhelper及方法使用指南

上一篇 / 下一篇 2009-03-05 21:01:48

查看( 888 ) / 评论( 0 ) / 评分( 0 / 0 )

要在VS2005中使用sqlhelper类,必须把Microsoft.ApplicationBlocks.Data.dll引用到项目中. 1.通过存储过程查询的方法SqlHelper.ExecuteDataset(数据库连接字符, 存储过程字符, 参数数组); 2.通过字符串查询的方法SqlHelper.ExecuteDataset(数据库连接字符, CommandType.Text , 查询字符串,参数数组);

3.通过存储过程插入的方法SqlHelper.ExecuteScalar(数据库连接字符, 存储过程字符, 参数数组); 4.通过字符串插入的方法SqlHelper.ExecuteScalar(数据库连接字符, CommandType.Text , 插入及刷新字符串,参数数组);

5.通过存储过程刷新的方法SqlHelper.ExecuteNonQuery(数据库连接字符, 存储过程字符, 参数数组); 6.通过字符串刷新的方法SqlHelper.ExecuteNonQuery(数据库连接字符, CommandType.Text , 刷新字符串,参数数组); 运用实例

using System; using System.Data;

using System.Data.SqlClient;

using Microsoft.ApplicationBlocks.Data; using System.IO; namespace SK.VideoDAL {

///

/// File 的摘要说明。

///

public class File {

///

/// 文件数据访问类 /// public File() { //

// TODO: 在此处添加构造函数逻辑 // }

///

/// 添加文件 ///

/// 文件分类编号 /// 推荐方式 /// 固顶方式 /// 文件名称 /// 简介 /// 大小 /// 评级 /// 关键字 /// 预览图地址 /// 发布人ID /// 文件类别编号 /// 下载要求 /// 下载所需点数 /// 状态

public object Add(object FileClassID,object SetCommend,object SetTop,object Name,object Intro, object FileSize,object Grade,object Keyword,object PreviewUrl,object MemberID,object FileTypeID,

object DownRequire,object NeedPoint,object Status,object Actor,object Level,object Region) {

SqlParameter[] oParms = new SqlParameter[17];

oParms[0]=new SqlParameter(\"@FileClassID\ oParms[1]=new SqlParameter(\"@SetCommend\ oParms[2]=new SqlParameter(\"@SetTop\ oParms[3]=new SqlParameter(\"@Name\ oParms[4]=new SqlParameter(\"@Intro\ oParms[5]=new SqlParameter(\"@FileSize\ oParms[6]=new SqlParameter(\"@Grade\ oParms[7]=new SqlParameter(\"@Keyword\ oParms[8]=new SqlParameter(\"@PreviewUrl\ oParms[9]=new SqlParameter(\"@MemberID\ oParms[10]=new SqlParameter(\"@FileTypeID\ oParms[11]=new SqlParameter(\"@DownRequire\ oParms[12]=new SqlParameter(\"@NeedPoint\ oParms[13]=new SqlParameter(\"@Status\ oParms[14]=new SqlParameter(\"@Actor\ oParms[15]=new SqlParameter(\"@Level\ oParms[16]=new SqlParameter(\"@Region\

return SqlHelper.ExecuteScalar(Data.ConnString, CommandType.Text ,\"INSERT INTO [File] ( [FileClassID], SetCommend,SetTop,[Name],[Intro], [FileSize], [Grade], [Keyword], [PreviewUrl], MemberID,FileTypeID,[CreateTime],

[UpdateTime],Downloads,Hits,DownRequire,NeedPoint,Status,Actor,[Level],Region)

VALUES(@FileClassID,@SetCommend,@SetTop,@Name,@Intro,@FileSize,@Grade,@Keyword,@PreviewUrl,@MemberID,@FileTypeID,getdate(),getdate(),0,0,@DownRequire,@NeedPoint,@Status,@Actor,@Level,@Region); select @@IDENTITY\ }

///

/// 更新指定的文件信息 ///

/// 文件编号

/// 文件类别编号 /// 文件分类编号 /// 推荐方式 /// 固顶方式 /// 文件名称 /// 简介 /// 大小 /// 评级 /// 关键字 /// 预览图地址 /// 下载要求 /// 下载所需点数 /// 状态

public void Update(object FileID,object FileTypeID,object FileClassID,object SetCommend,object SetTop,

object Name,object Intro,object FileSize,object Grade,object Keyword,object PreviewUrl, object DownRequire,object NeedPoint,object Status,object Actor,object Level,object Region) {

SqlParameter[] oParms = new SqlParameter[17]; oParms[0]=new SqlParameter(\"@FileID\

oParms[1]=new SqlParameter(\"@FileTypeID\ oParms[2]=new SqlParameter(\"@FileClassID\ oParms[3]=new SqlParameter(\"@SetCommend\ oParms[4]=new SqlParameter(\"@SetTop\ oParms[5]=new SqlParameter(\"@Name\ oParms[6]=new SqlParameter(\"@Intro\ oParms[7]=new SqlParameter(\"@FileSize\ oParms[8]=new SqlParameter(\"@Grade\ oParms[9]=new SqlParameter(\"@Keyword\ oParms[10]=new SqlParameter(\"@PreviewUrl\ oParms[11]=new SqlParameter(\"@DownRequire\

oParms[12]=new SqlParameter(\"@NeedPoint\ oParms[13]=new SqlParameter(\"@Status\ oParms[14]=new SqlParameter(\"@Actor\ oParms[15]=new SqlParameter(\"@Level\ oParms[16]=new SqlParameter(\"@Region\

SqlHelper.ExecuteNonQuery(Data.ConnString, CommandType.Text,\" update [File] set

FileTypeID=@FileTypeID,FileClassID=@FileClassID,SetCommend=@SetCommend,SetTop=@SetTop,[Name]=@Name,Intro=@Intro,FileSize=@FileSize,Grade=@Grade,Keyword=@Keyword,PreviewUrl=@PreviewUrl,UpdateTime=getdate(),DownRequire=@DownRequire,NeedPoint=@NeedPoint,Status=@Status,Actor=@Actor,[Level]=@Level,Region=@Region where FileID=@FileID\ }

///

/// 删除文件 ///

/// 文件编号 public void Delete(object FileID) {

string spName; SqlParameter[] oParms; spName = \"File_Delete\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=FileID;

SqlHelper.ExecuteNonQuery(Data.ConnString, spName, oParms); }

///

/// 返回指定的文件信息 ///

/// 文件编号 ///

public DataRow Info(object FileID)

{

SqlParameter[] oParms =new SqlParameter[1]; oParms[0] = new SqlParameter(\"@FileID\

return SqlHelper.ExecuteDataset(Data.ConnString,CommandType.Text,\"select * from [File] where FileID=@FileID\ }

///

/// 指定分类的文件列表(按更新时间排序) ///

/// 分类编号 /// /// ///

public DataSet List(object FileClassID,object PageSize,object PageIndex,object ImageFileSmall_Null) {

string spName; SqlParameter[] oParms; spName = \"File_List\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=FileClassID; oParms[1].Value=PageSize; oParms[2].Value=PageIndex; oParms[3].Value=0;

oParms[4].Value=ImageFileSmall_Null;

return SqlHelper.ExecuteDataset(Data.ConnString, spName, oParms); }

///

/// 指定分类的文件列表(按大小排序) ///

/// 分类编号

/// /// ///

public DataSet List_OrderBySize(object FileClassID,object PageSize,object PageIndex,object ImageFileSmall_Null) {

string spName; SqlParameter[] oParms;

spName = \"File_List_OrderBySize\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=FileClassID; oParms[1].Value=PageSize; oParms[2].Value=PageIndex; oParms[3].Value=0;

oParms[4].Value=ImageFileSmall_Null;

return SqlHelper.ExecuteDataset(Data.ConnString, spName, oParms); }

///

/// 指定分类的文件列表(按评级排序) ///

/// 分类编号 /// /// ///

public DataSet List_OrderByGrade(object FileClassID,object PageSize,object PageIndex,object ImageFileSmall_Null) {

string spName; SqlParameter[] oParms;

spName = \"File_List_OrderByGrade\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName);

oParms[0].Value=FileClassID; oParms[1].Value=PageSize; oParms[2].Value=PageIndex; oParms[3].Value=0;

oParms[4].Value=ImageFileSmall_Null;

return SqlHelper.ExecuteDataset(Data.ConnString, spName, oParms); }

///

/// 指定分类的文件列表(按人气排序) ///

/// 分类编号 /// /// ///

public DataSet List_OrderByDownloads(object FileClassID,object PageSize,object PageIndex,object ImageFileSmall_Null) {

string spName; SqlParameter[] oParms;

spName = \"File_List_OrderByDownloads\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=FileClassID; oParms[1].Value=PageSize; oParms[2].Value=PageIndex; oParms[3].Value=0;

oParms[4].Value=ImageFileSmall_Null;

return SqlHelper.ExecuteDataset(Data.ConnString, spName, oParms); }

///

/// 指定分类的文件总数

///

/// 分类编号 ///

public int List_Count(object FileClassID) {

string spName; SqlParameter[] oParms; spName = \"File_List\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=FileClassID; oParms[1].Value=0; oParms[2].Value=0; oParms[3].Value=1;

return Convert.ToInt32(SqlHelper.ExecuteScalar(Data.ConnString, spName, oParms)); }

///

/// 返回指定分类的下载排行 ///

/// 分类编号 /// 记录数 ///

public DataSet DownTop(object FileClassID,object Num,object ImageFileSmall_Null) {

string spName; SqlParameter[] oParms; spName = \"File_DownTop\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=FileClassID; oParms[1].Value=Num;

oParms[2].Value=ImageFileSmall_Null;

return SqlHelper.ExecuteDataset(Data.ConnString, spName, oParms); }

///

/// 返回指定分类的最新文件 ///

/// 分类编号 /// 记录数 ///

public DataSet NewTop(object FileClassID,object Num,object ImageFileSmall_Null) {

string spName; SqlParameter[] oParms; spName = \"File_NewTop\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=FileClassID; oParms[1].Value=Num;

oParms[2].Value=ImageFileSmall_Null;

return SqlHelper.ExecuteDataset(Data.ConnString, spName, oParms); }

///

/// 分类推荐排行 ///

/// /// ///

public DataSet CommendTop(object FileClassID,object Num,object ImageFileSmall_Null) {

string spName; SqlParameter[] oParms; spName = \"File_CommendTop\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName);

oParms[0].Value=FileClassID; oParms[1].Value=Num;

oParms[2].Value=ImageFileSmall_Null;

return SqlHelper.ExecuteDataset(Data.ConnString, spName, oParms); }

///

/// 返回最新的文件 ///

/// 数量 ///

public DataSet NewTop(object Num,object ImageFileSmall) {

return SqlHelper.ExecuteDataset(Data.ConnString,CommandType.Text,String.Format(\"select Top {0} a.FileID,a.[Name] as

FileName,a.FileClassID,a.Intro,a.UpdateTime,a.Downloads,a.Hits,b.ClassName,case when

c.ImageFileSmall is null then '{1}' else c.ImageFileSmall end as ImageFileSmall from [File] a LEFT JOIN FileClass b ON a.FileClassID=b.FileClassID LEFT JOIN FilePicture c ON a.FileID=c.FileID and c.IsPre=1 where a.Status=1 order by a.UpdateTime desc\ }

///

/// 返回最新视频 ///

/// 返回数量条数 ///

public DataSet NewTop(object Num) {

return SqlHelper.ExecuteDataset(Data.ConnString,CommandType.Text,String.Format(\"select Top {0} a.FileID,a.[Name] as FileName,a.FileClassID,a.Intro,a.UpdateTime,a.Downloads,a.Hits,b.ClassName from [File] a LEFT JOIN FileClass b ON a.FileClassID=b.FileClassID order by a.UpdateTime desc\

}

///

/// 返回所有视频的下载排行 ///

/// 数量 ///

public DataSet DownloadTop_AllFile(object Num) {

return SqlHelper.ExecuteDataset(Data.ConnString,CommandType.Text,String.Format(\"select Top {0} a.FileID,a.[Name] as FileName,a.FileClassID,a.UpdateTime,a.Downloads,a.Hits from [File] a LEFT JOIN FileClass b ON a.FileClassID=b.FileClassID order by a.Downloads desc\ }

///

/// 返回所有视频的点击排行 ///

/// 数量 ///

public DataSet HitsTop_AllFile(object Num) {

return SqlHelper.ExecuteDataset(Data.ConnString,CommandType.Text,String.Format(\"select Top {0} a.FileID,a.[Name] as FileName,a.FileClassID,a.UpdateTime,a.Downloads,a.Hits,b.ClassName from [File] a LEFT JOIN FileClass b ON a.FileClassID=b.FileClassID order by a.Hits desc\ }

///

/// 返回所有视频的最新推荐 ///

/// 数量 ///

public DataSet CommendTop_AllFile(object Num) {

return SqlHelper.ExecuteDataset(Data.ConnString,CommandType.Text,String.Format(\"select Top {0} a.FileID,a.[Name] as FileName,b.ClassName,a.FileClassID,a.UpdateTime,a.Downloads,a.Hits from [File]

a LEFT JOIN FileClass b ON a.FileClassID=b.FileClassID where a.SetCommend!=0 order by a.UpdateTime desc\ }

///

/// 返回所有软件的下载排行 ///

/// 数量 ///

public DataSet DownloadTop_AllFile(object Num,object ImageFileSmall) {

return SqlHelper.ExecuteDataset(Data.ConnString,CommandType.Text,String.Format(\"select Top {0} a.FileID,a.[Name] as FileName,a.FileClassID,a.UpdateTime,a.Downloads,a.Hits,b.ClassName,case when c.ImageFileSmall is null then '{1}' else c.ImageFileSmall end as ImageFileSmall from [File] a LEFT JOIN FileClass b ON a.FileClassID=b.FileClassID LEFT JOIN FilePicture c ON a.FileID=c.FileID and c.IsPre=1 where a.Status=1 order by a.Downloads desc\ }

///

/// 返回所有软件的最新推荐 ///

/// 数量 ///

public DataSet CommendTop_AllFile(object Num,object ImageFileSmall) {

return SqlHelper.ExecuteDataset(Data.ConnString,CommandType.Text,String.Format(\"select Top {0} a.FileID,a.[Name] as FileName,a.FileClassID,a.UpdateTime,a.Downloads,a.Hits,b.ClassName,case when c.ImageFileSmall is null then '{1}' else c.ImageFileSmall end as ImageFileSmall from [File] a LEFT JOIN FileClass b ON a.FileClassID=b.FileClassID LEFT JOIN FilePicture c ON a.FileID=c.FileID and c.IsPre=1 where a.SetCommend!=0 and a.Status=1 order by a.UpdateTime desc\ }

///

/// 返回符合条件的文件列表 ///

/// 文件名称 /// 分类编号 /// 每页数 /// 页码 ///

public DataSet Search(object Name,object FileClassID,object PageSize,object PageIndex) {

string spName; SqlParameter[] oParms; spName = \"File_Search\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=Name; oParms[1].Value=FileClassID; oParms[2].Value=PageSize; oParms[3].Value=PageIndex; oParms[4].Value=0;

return SqlHelper.ExecuteDataset(Data.ConnString, spName, oParms); }

///

/// 返回搜索结果行数 ///

/// 文件名称 /// 文件分类 ///

public int Search_Count(object Name,object FileClassID) {

string spName;

SqlParameter[] oParms; spName = \"File_Search\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=Name; oParms[1].Value=FileClassID; oParms[2].Value=0; oParms[3].Value=0; oParms[4].Value=1;

return Convert.ToInt32(SqlHelper.ExecuteScalar(Data.ConnString, spName, oParms)); }

///

/// 返回符合条件的文件列表 ///

/// 文件名称 /// 分类编号 /// 每页数 /// 页码 ///

public DataSet Search_Name(object Name,object FileClassID,object PageSize,object PageIndex) {

string spName; SqlParameter[] oParms; spName = \"File_Search_Name\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=Name; oParms[1].Value=FileClassID; oParms[2].Value=PageSize; oParms[3].Value=PageIndex; oParms[4].Value=0;

return SqlHelper.ExecuteDataset(Data.ConnString, spName, oParms);

}

///

/// 返回搜索结果行数 ///

/// 文件名称 /// 文件分类 ///

public int Search_Name_Count(object Name,object FileClassID) {

string spName; SqlParameter[] oParms; spName = \"File_Search_Name\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=Name; oParms[1].Value=FileClassID; oParms[2].Value=0; oParms[3].Value=0; oParms[4].Value=1;

return Convert.ToInt32(SqlHelper.ExecuteScalar(Data.ConnString, spName, oParms)); }

///

/// 返回符合条件的文件列表 ///

/// 文件名称 /// 分类编号 /// 每页数 /// 页码 ///

public DataSet Search_Intro(object Name,object FileClassID,object PageSize,object PageIndex) {

string spName;

SqlParameter[] oParms; spName = \"File_Search_Intro\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=Name; oParms[1].Value=FileClassID; oParms[2].Value=PageSize; oParms[3].Value=PageIndex; oParms[4].Value=0;

return SqlHelper.ExecuteDataset(Data.ConnString, spName, oParms); }

///

/// 返回搜索结果行数 ///

/// 文件名称 /// 文件分类 ///

public int Search_Intro_Count(object Name,object FileClassID) {

string spName; SqlParameter[] oParms; spName = \"File_Search_Intro\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=Name; oParms[1].Value=FileClassID; oParms[2].Value=0; oParms[3].Value=0; oParms[4].Value=1;

return Convert.ToInt32(SqlHelper.ExecuteScalar(Data.ConnString, spName, oParms)); }

///

/// 返回符合条件的文件列表(不定分类) ///

/// 文件名称 /// 每页数 /// 页码 ///

public DataSet Search_AllClass(object Name,object PageSize,object PageIndex) {

string spName; SqlParameter[] oParms;

spName = \"File_Search_AllClass\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=Name; oParms[1].Value=PageSize; oParms[2].Value=PageIndex; oParms[3].Value=0;

return SqlHelper.ExecuteDataset(Data.ConnString, spName, oParms); }

///

/// 返回搜索结果行数(不定分类) ///

/// ///

public int Search_AllClass_Count(object Name) {

string spName; SqlParameter[] oParms;

spName = \"File_Search_AllClass\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=Name; oParms[1].Value=0;

oParms[2].Value=0; oParms[3].Value=1;

return Convert.ToInt32(SqlHelper.ExecuteScalar(Data.ConnString, spName, oParms)); }

///

/// 返回符合条件的文件列表(不定分类) ///

/// 文件名称 /// 每页数 /// 页码 ///

public DataSet Search_AllClass_Name(object Name,object PageSize,object PageIndex) {

string spName; SqlParameter[] oParms;

spName = \"File_Search_AllClass_Name\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=Name; oParms[1].Value=PageSize; oParms[2].Value=PageIndex; oParms[3].Value=0;

return SqlHelper.ExecuteDataset(Data.ConnString, spName, oParms); }

///

/// 返回搜索结果行数(不定分类) ///

/// ///

public int Search_AllClass_Name_Count(object Name) {

string spName; SqlParameter[] oParms;

spName = \"File_Search_AllClass_Name\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=Name; oParms[1].Value=0; oParms[2].Value=0; oParms[3].Value=1;

return Convert.ToInt32(SqlHelper.ExecuteScalar(Data.ConnString, spName, oParms)); }

///

/// 返回符合条件的文件列表(不定分类) ///

/// 文件名称 /// 每页数 /// 页码 ///

public DataSet Search_AllClass_Intro(object Name,object PageSize,object PageIndex) {

string spName; SqlParameter[] oParms;

spName = \"File_Search_AllClass_Intro\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=Name; oParms[1].Value=PageSize; oParms[2].Value=PageIndex; oParms[3].Value=0;

return SqlHelper.ExecuteDataset(Data.ConnString, spName, oParms); }

///

/// 返回搜索结果行数(不定分类) ///

/// ///

public int Search_AllClass_Intro_Count(object Name) {

string spName; SqlParameter[] oParms;

spName = \"File_Search_AllClass_Intro\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=Name; oParms[1].Value=0; oParms[2].Value=0; oParms[3].Value=1;

return Convert.ToInt32(SqlHelper.ExecuteScalar(Data.ConnString, spName, oParms)); }

///

/// 不可见的文件列表 ///

/// /// ///

public DataSet List_NeedAudit(object PageSize,object PageIndex) {

string spName; SqlParameter[] oParms;

spName = \"File_List_NeedAudit\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=PageSize; oParms[1].Value=PageIndex; oParms[2].Value=0;

return SqlHelper.ExecuteDataset(Data.ConnString, spName, oParms); }

///

/// 不可见的文件数量 /// ///

public int List_NeedAudit_Count() {

string spName; SqlParameter[] oParms;

spName = \"File_List_NeedAudit\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName); oParms[0].Value=0; oParms[1].Value=0; oParms[2].Value=1;

return Convert.ToInt32(SqlHelper.ExecuteScalar(Data.ConnString, spName, oParms)); }

///

/// 返回相关的文件 ///

/// 当前文件编号 /// 关键字 /// 数量 ///

public DataSet RelatedList(object FileID,object Keyword,object Num) {

SqlParameter[] oParms = new SqlParameter[2]; oParms[0]=new SqlParameter(\"@FileID\ oParms[1]=new SqlParameter(\"@Keyword\

return SqlHelper.ExecuteDataset(Data.ConnString,CommandType.Text,String.Format(\"select Top {0} a.FileID,a.[Name] as FileName,a.FileClassID,a.UpdateTime,a.Downloads,a.Hits from [File] a LEFT JOIN FileClass b ON a.FileClassID=b.FileClassID where a.Status=1 and a.FileID!=@FileID and a.Keyword!='' and a.Keyword like '%'+@Keyword+'%'order by a.UpdateTime desc\ }

///

/// 浏览加1 ///

/// 编号 public void HitAddOne(object FileID) {

SqlParameter[] oParms = new SqlParameter[1]; oParms[0]=new SqlParameter(\"@FileID\

SqlHelper.ExecuteNonQuery(Data.ConnString,CommandType.Text,\"update [File] set Hits=Hits+1 where FileID=@FileID\ }

///

/// 下载加1 ///

/// 编号 public void DownloadAddOne(object FileID) {

SqlParameter[] oParms = new SqlParameter[1]; oParms[0]=new SqlParameter(\"@FileID\

SqlHelper.ExecuteNonQuery(Data.ConnString,CommandType.Text,\"update [File] set Downloads=Downloads+1 where FileID=@FileID\ }

///

/// 统计软件信息 /// /// public DataRow Total()

{

string spName; SqlParameter[] oParms; spName = \"File_Total\";

oParms = SqlHelperParameterCache.GetSpParameterSet(Data.ConnString, spName);

return SqlHelper.ExecuteDataset(Data.ConnString, spName, oParms).Tables[0].Rows[0]; }

///

/// 修改文件类别编号 ///

/// 文件编号

/// 文件类别编号 public void UpdateFileTypeID(object FileID,object FileTypeID) {

SqlParameter[] oParms = new SqlParameter[2]; oParms[0]=new SqlParameter(\"@FileID\

oParms[1]=new SqlParameter(\"@FileTypeID\

SqlHelper.ExecuteNonQuery(Data.ConnString,CommandType.Text,\"update [File] set FileTypeID=@FileTypeID where FileID=@FileID\ }

///

/// 统计各用户发布的文件数量 ///

/// 开始时间 /// 结束时间 ///

public DataSet Total_Member(object BeginDate,object EndDate) {

return SqlHelper.ExecuteDataset(Data.ConnString,CommandType.Text,String.Format(\"select Count(a.FileID) as FileCount,a.MemberID from [File] a where a.MemberID is not null and

CreateTime >='{0}' and CreateTime<='{1}' Group by a.MemberID order by Count(FileID) desc\

因篇幅问题不能全部显示,请点此查看更多更全内容