本文整理汇总了C#中CY.Utility.DBUtility.SqlServerUtility.ExecuteSqlReader方法的典型用法代码示例。如果您正苦于以下问题:C# SqlServerUtility.ExecuteSqlReader方法的具体用法?C# SqlServerUtility.ExecuteSqlReader怎么用?C# SqlServerUtility.ExecuteSqlReader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CY.Utility.DBUtility.SqlServerUtility
的用法示例。
在下文中一共展示了SqlServerUtility.ExecuteSqlReader方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetByModuleCode
public IList<CY.CYWebsite.Core.Business.Web_News> GetByModuleCode(string strModuleCode)
{
IList<CY.CYWebsite.Core.Business.Web_News> list_news = new List<CY.CYWebsite.Core.Business.Web_News>();
SqlServerUtility sqlhelper = new SqlServerUtility();
SqlDataReader reader;
if (!strModuleCode.Trim().Equals(""))
{
sqlhelper.AddParameter("@Module_Code", SqlDbType.VarChar, strModuleCode, 10);
reader = sqlhelper.ExecuteSqlReader(strSQLSelectByModuleCode.ToString());
}
else
{
reader = sqlhelper.ExecuteSqlReader(SqlGetAllWeb_News.ToString());
}
if (reader != null && !reader.IsClosed)
{
while (reader.Read())
{
CY.CYWebsite.Core.Business.Web_News news = new CY.CYWebsite.Core.Business.Web_News();
if (!reader.IsDBNull(0)) { news.Id = reader.GetInt32(0); }
if (!reader.IsDBNull(1)) { news.News_Content = reader.GetString(1); }
if (!reader.IsDBNull(2)) { news.News_PubDate = reader.GetDateTime(2); }
if (!reader.IsDBNull(3)) { news.News_Title = reader.GetString(3); }
if (!reader.IsDBNull(4)) { news.Module_Code = reader.GetString(4); }
if (!reader.IsDBNull(5)) { news.Manager_Code = reader.GetString(5); }
list_news.Add(news);
}
reader.Close();
return list_news;
}
return null;
}
示例2: GetAllWishingComment
public IList<Core.Business.WishingComment> GetAllWishingComment()
{
IList<Core.Business.WishingComment> wishingCommentlist = new List<Core.Business.WishingComment>();
SqlServerUtility sql = new SqlServerUtility(SqlConnection);
SqlDataReader reader = sql.ExecuteSqlReader("");
if (reader != null)
{
while (reader.Read())
{
Core.Business.WishingComment wishingComment = new Core.Business.WishingComment();
if (!reader.IsDBNull(0)) wishingComment.Id = reader.GetInt64(0);
if (!reader.IsDBNull(1)) wishingComment.DateCreated = reader.GetDateTime(1);
if (!reader.IsDBNull(2)) wishingComment.InstanceId = reader.GetInt64(2);
if (!reader.IsDBNull(3)) wishingComment.AuthorId = reader.GetInt64(3);
if (!reader.IsDBNull(4)) wishingComment.Content = reader.GetString(4);
wishingComment.MarkOld();
wishingCommentlist.Add(wishingComment);
}
reader.Close();
}
return wishingCommentlist;
}
示例3: GetAllMessages
public IList<Core.Business.Messages> GetAllMessages()
{
IList<Core.Business.Messages> messageslist = new List<Core.Business.Messages>();
SqlServerUtility sql = new SqlServerUtility(connectionString);
SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllMessages);
if (reader != null)
{
while (reader.Read())
{
Core.Business.Messages messages = new Core.Business.Messages();
if (!reader.IsDBNull(0)) messages.Id = reader.GetInt64(0);
if (!reader.IsDBNull(1)) messages.Content = reader.GetString(1);
if (!reader.IsDBNull(2)) messages.Type = reader.GetInt32(2);
if (!reader.IsDBNull(3)) messages.DateCreated = reader.GetDateTime(3);
if (!reader.IsDBNull(4)) messages.SendDate = reader.GetDateTime(4);
if (!reader.IsDBNull(5)) messages.IsRead = reader.GetInt32(5);
if (!reader.IsDBNull(6)) messages.AuthorId = reader.GetInt64(6);
if (!reader.IsDBNull(7)) messages.AccountId = reader.GetInt64(7);
if (!reader.IsDBNull(8)) messages.Title = reader.GetString(8);
if (!reader.IsDBNull(9)) messages.Attachments = reader.GetString(9);
if (!reader.IsDBNull(10)) messages.AuthorName = reader.GetString(10);
if (!reader.IsDBNull(11)) messages.AccountName = reader.GetString(11);
messages.MarkOld();
messageslist.Add(messages);
}
reader.Close();
}
return messageslist;
}
示例4: Delete
public void Delete(Core.Business.FavoritesComment favoritesComment)
{
SqlServerUtility sql = new SqlServerUtility(connectionString);
sql.AddParameter("@Id", SqlDbType.BigInt, favoritesComment.Id);
sql.ExecuteSqlReader(SqlDeleteFavoritesComment);
}
示例5: GetUserAnswerByVoteItemList
public IList<Core.Business.UserAnswer> GetUserAnswerByVoteItemList(IList<CY.CSTS.Core.Business.VoteItem> vIList)
{
IList<Core.Business.UserAnswer> userAnswerlist = new List<Core.Business.UserAnswer>();
foreach (Core.Business.VoteItem vI in vIList )
{
SqlServerUtility sql = new SqlServerUtility();
sql.AddParameter("@voteItemID", SqlDbType.Int, vI.Id);
SqlDataReader reader = sql.ExecuteSqlReader(SqlGetUserAnswerByVoteItemID);
if (reader != null)
{
while (reader.Read())
{
Core.Business.UserAnswer userAnswer = new Core.Business.UserAnswer();
if (!reader.IsDBNull(0)) userAnswer.Id = reader.GetInt32(0);
if (!reader.IsDBNull(1)) userAnswer.VoteRecordID = reader.GetInt32(1);
if (!reader.IsDBNull(2)) userAnswer.VoteItemID = reader.GetInt32(2);
if (!reader.IsDBNull(3)) userAnswer.AnswerContent = reader.GetString(3);
userAnswer.MarkOld();
userAnswerlist.Add(userAnswer);
}
reader.Close();
}
}
return userAnswerlist;
}
示例6: GetAllAccountRecommend
public IList<Core.Business.AccountRecommend> GetAllAccountRecommend()
{
IList<Core.Business.AccountRecommend> accountRecommendlist = new List<Core.Business.AccountRecommend>();
SqlServerUtility sql = new SqlServerUtility();
SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllAccountRecommend);
if(reader != null)
{
while(reader.Read())
{
Core.Business.AccountRecommend accountRecommend = new Core.Business.AccountRecommend();
if (!reader.IsDBNull(0)) accountRecommend.Id = reader.GetInt64(0);
if (!reader.IsDBNull(1)) accountRecommend.RecommendDate = reader.GetDateTime(1);
if (!reader.IsDBNull(2)) accountRecommend.AccountId = reader.GetInt64(2);
if (!reader.IsDBNull(3)) accountRecommend.RecommendId = reader.GetInt64(3);
if (!reader.IsDBNull(4)) accountRecommend.AccountName = reader.GetString(4);
accountRecommend.MarkOld();
accountRecommendlist.Add(accountRecommend);
}
reader.Close();
}
return accountRecommendlist;
}
示例7: GetBySql
public IList<Core.Business.VirtualLabDataBigClass> GetBySql(string sqlwhere)
{
IList<Core.Business.VirtualLabDataBigClass> virtualLabDataBigClasslist = new List<Core.Business.VirtualLabDataBigClass>();
SqlServerUtility sql = new SqlServerUtility();
string sqlstr = "SELECT * FROM [dbo].[VirtualLabDataBigClass] where ";
sqlstr += sqlwhere;
SqlDataReader reader = sql.ExecuteSqlReader(sqlstr);
if (reader != null)
{
while (reader.Read())
{
Core.Business.VirtualLabDataBigClass virtualLabDataBigClass = new Core.Business.VirtualLabDataBigClass();
if (!reader.IsDBNull(0)) virtualLabDataBigClass.Id = reader.GetGuid(0);
if (!reader.IsDBNull(1)) virtualLabDataBigClass.Name = reader.GetString(1);
if (!reader.IsDBNull(2)) virtualLabDataBigClass.VirturlLabID = reader.GetGuid(2);
virtualLabDataBigClass.MarkOld();
virtualLabDataBigClasslist.Add(virtualLabDataBigClass);
}
reader.Close();
}
return virtualLabDataBigClasslist;
}
示例8: GetAllUserAnswer
public IList<Core.Business.UserAnswer> GetAllUserAnswer()
{
IList<Core.Business.UserAnswer> userAnswerlist = new List<Core.Business.UserAnswer>();
SqlServerUtility sql = new SqlServerUtility();
SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllUserAnswer);
if(reader != null)
{
while(reader.Read())
{
Core.Business.UserAnswer userAnswer = new Core.Business.UserAnswer();
if (!reader.IsDBNull(0)) userAnswer.Id = reader.GetInt32(0);
if (!reader.IsDBNull(1)) userAnswer.VoteRecordID = reader.GetInt32(1);
if (!reader.IsDBNull(2)) userAnswer.VoteItemID = reader.GetInt32(2);
if (!reader.IsDBNull(3)) userAnswer.AnswerContent = reader.GetString(3);
userAnswer.MarkOld();
userAnswerlist.Add(userAnswer);
}
reader.Close();
}
return userAnswerlist;
}
示例9: GetVoteItemByVoteID
public IList<Core.Business.VoteItem> GetVoteItemByVoteID(int id)
{
IList<Core.Business.VoteItem> voteItemlist = new List<Core.Business.VoteItem>();
SqlServerUtility sql = new SqlServerUtility();
sql.AddParameter("@voteid", SqlDbType.Int, id);
SqlDataReader reader = sql.ExecuteSqlReader(SqlGetVoteItemByVoteID);
if (reader != null)
{
while (reader.Read())
{
Core.Business.VoteItem voteItem = new Core.Business.VoteItem();
if (!reader.IsDBNull(0)) voteItem.Id = reader.GetInt32(0);
if (!reader.IsDBNull(1)) voteItem.VoteID = reader.GetInt32(1);
if (!reader.IsDBNull(2)) voteItem.IsMutiChoose = reader.GetInt32(2);
if (!reader.IsDBNull(3)) voteItem.IsUserDefine = reader.GetInt32(3);
if (!reader.IsDBNull(4)) voteItem.VoteItemContent = reader.GetString(4);
voteItem.MarkOld();
voteItemlist.Add(voteItem);
}
reader.Close();
}
return voteItemlist;
}
示例10: GetCommentCountByFavoritesId
public int GetCommentCountByFavoritesId(CY.UME.Core.Business.Favorites favorites)
{
int count = 0;
if (favorites == null)
{
return count;
}
SqlServerUtility sql = new SqlServerUtility(connectionString);
sql.AddParameter("@FavoritesId", SqlDbType.BigInt, favorites.Id);
SqlDataReader reader = sql.ExecuteSqlReader(SqlGetFavoritesCommentCountByInstanceId);
if (reader != null && !reader.IsClosed && reader.Read())
{
if (!reader.IsDBNull(0)) count = reader.GetInt32(0);
reader.Close();
}
else
{
if (reader != null && !reader.IsClosed)
reader.Close();
}
return count;
}
示例11: getCount
public int getCount(string strWhere)
{
SqlServerUtility sql = new SqlServerUtility();
if (strWhere.Trim().Equals(""))
{
strWhere = "1=1";
}
string sqlstr = "select count(*) from InstrumentPictureRepository where " + strWhere + "";
SqlDataReader reader = sql.ExecuteSqlReader(sqlstr);
int count = 0;
if (reader != null && !reader.IsClosed && reader.Read())
{
if (!reader.IsDBNull(0)) count = reader.GetInt32(0);
reader.Close();
return count;
}
else
{
if (reader != null && !reader.IsClosed)
reader.Close();
return count;
}
}
示例12: GetByVoteId
public IList<CY.CSTS.Core.Business.VoteRole> GetByVoteId(int voteID)
{
IList<Core.Business.VoteRole> voteRolelist = new List<Core.Business.VoteRole>();
SqlServerUtility sql = new SqlServerUtility();
sql.AddParameter("@VoteID",SqlDbType.Int,voteID);
SqlDataReader reader = sql.ExecuteSqlReader(SqlGetByVoteID);
if (reader != null)
{
while (reader.Read())
{
Core.Business.VoteRole voteRole = new Core.Business.VoteRole();
if (!reader.IsDBNull(0)) voteRole.Id = reader.GetInt32(0);
if (!reader.IsDBNull(1)) voteRole.DepartmentID = reader.GetInt32(1);
if (!reader.IsDBNull(2)) voteRole.VoteID = reader.GetInt32(2);
if (!reader.IsDBNull(3)) voteRole.RoleID = reader.GetInt32(3);
voteRole.MarkOld();
voteRolelist.Add(voteRole);
}
reader.Close();
}
return voteRolelist;
}