本文整理汇总了C#中StoredProcedure.GetReader方法的典型用法代码示例。如果您正苦于以下问题:C# StoredProcedure.GetReader方法的具体用法?C# StoredProcedure.GetReader怎么用?C# StoredProcedure.GetReader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StoredProcedure
的用法示例。
在下文中一共展示了StoredProcedure.GetReader方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSearchResults
public static SimpleSearchCollection GetSearchResults(string SearchType, string SubType, string SearchFor, string SearchItem, string ConnectionString)
{
StoredProcedure sp = new StoredProcedure("SLLookupSearch");
sp.Command.AddParameter("@SearchType", SearchType);
sp.Command.AddParameter("@SubType", SubType);
sp.Command.AddParameter("@SearchFor", SearchFor);
sp.Command.AddParameter("@SearchItem", SearchItem);
IDataReader results = sp.GetReader();
SimpleSearchCollection sCol = new SimpleSearchCollection();
while (results.Read())
{
SimpleSearch ss = new SimpleSearch();
ss.ID = (string)results["ID"];
ss.Name = (string)results["Name"];
sCol.Add(ss);
}
return sCol;
}
示例2: SP_ReaderTest
public void SP_ReaderTest()
{
StoredProcedure sp = new StoredProcedure("CustOrderHist", DataService.GetInstance("Northwind"));
sp.Command.AddParameter("@CustomerID", "ALFKI", DbType.AnsiString);
int counter = 0;
using(IDataReader rdr = sp.GetReader())
{
while(rdr.Read())
counter++;
rdr.Close();
}
Assert.IsTrue(counter > 0);
}
示例3: SP_Should_Execute_Without_Parameter2
public void SP_Should_Execute_Without_Parameter2()
{
StoredProcedure sp = new StoredProcedure("Ten Most Expensive Products", DataService.Providers["Northwind"]);
int count = 0;
using (IDataReader rdr =sp.GetReader())
{
while (rdr.Read())
count++;
rdr.Close();
}
sp.Execute();
Assert.IsTrue(count > 0);
}