sqlDataReader:

   public SqlDataReader GetAuth_CourtListByAuth(int autIntNo)
{
// Create Instance of Connection and Command Object
SqlConnection myConnection = new SqlConnection(mConstr);
SqlCommand myCommand = new SqlCommand("Auth_CourtListByAuth", myConnection); // Mark the Command as a SPROC
myCommand.CommandType = CommandType.StoredProcedure; SqlParameter parameterAutIntNo = new SqlParameter("@AutIntNo", SqlDbType.Int, );
parameterAutIntNo.Value = autIntNo;
myCommand.Parameters.Add(parameterAutIntNo); // Execute the command
myConnection.Open();
SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConnection); // Return the data reader
return result;
}

List<Court> courts = new List<Court>();
CourtDB db = new CourtDB(connectionString);
SqlDataReader reader = db.GetAuth_CourtListByAuth(model.SearchAuthority);
while (reader.Read())
{
Court court = new Court();
court.CrtIntNo = Convert.ToInt32(reader["CrtIntNo"].ToString());
court.CrtName = reader["CrtDetails"].ToString();
courts.Add(court);
}
reader.Close();
courts.Insert(0, new Court() { CrtIntNo = 0, CrtName = this.Resource("msgSelectCourt") });
model.CourtList = new SelectList(courts as IEnumerable, "CrtIntNo", "CrtName");

 
 public int GetCourtIntNoByCourtNo(string courtNo)
{
// Create Instance of Connection and Command Object
SqlConnection myConnection = new SqlConnection(mConstr);
SqlCommand myCommand = new SqlCommand("CourtIntNoByCourtNo", myConnection); // Mark the Command as a SPROC
myCommand.CommandType = CommandType.StoredProcedure; // Add Parameters to SPROC
SqlParameter parameterCourtNo = new SqlParameter("@CrtNo", SqlDbType.VarChar, );
parameterCourtNo.Value = courtNo;
myCommand.Parameters.Add(parameterCourtNo); SqlParameter parameterCrtIntNo = new SqlParameter("@CrtIntNo", SqlDbType.Int, );
parameterCrtIntNo.Direction = ParameterDirection.Output;
myCommand.Parameters.Add(parameterCrtIntNo); try
{
myConnection.Open();
myCommand.ExecuteNonQuery();
myConnection.Dispose(); // Calculate the CustomerID using Output Param from SPROC
int getCrtIntNo = Convert.ToInt32(parameterCrtIntNo.Value); return getCrtIntNo;
}
catch (Exception e)
{
myConnection.Dispose();
string msg = e.Message;
return ;
}
}
  public DataSet GetSummonsForJudgement(int crIntNo, DateTime dt, string caseNo,
int pageSize, int pageIndex, out int totalCount, bool isPaidAtCourt = false)
{
SqlConnection con = new SqlConnection(this.connectionString);
SqlCommand com = new SqlCommand("CourtRoomSummonsListForJudgement", con);
com.CommandType = CommandType.StoredProcedure; com.Parameters.Add("@CRIntNo", SqlDbType.Int, ).Value = crIntNo;
com.Parameters.Add("@Date", SqlDbType.DateTime, ).Value = dt;
com.Parameters.Add("@CaseNo", SqlDbType.NVarChar, ).Value = caseNo;
com.Parameters.Add("@PageSize", SqlDbType.Int).Value = pageSize;
com.Parameters.Add("@PageIndex", SqlDbType.Int).Value = pageIndex;
com.Parameters.Add("@IsPaidAtCourt", SqlDbType.Bit).Value = isPaidAtCourt; SqlParameter paraTotalCount = new SqlParameter("@TotalCount", SqlDbType.Int);
paraTotalCount.Direction = ParameterDirection.Output;
com.Parameters.Add(paraTotalCount); DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(com);
da.Fill(ds);
da.Dispose(); totalCount = (int)(paraTotalCount.Value == DBNull.Value ? : paraTotalCount.Value); return ds;
}

最新文章

  1. .NET基础拾遗(6)ADO.NET与数据库开发基础
  2. windows10的第一天使用总结
  3. JSP学习网站
  4. cx_freeze 把 .py 打包成 .exe
  5. 合工大OJ 1337 一加二减三
  6. Netty 4(一) zero copy
  7. MyEclipse Servers视窗出现“Could not create the view: An unexpected exception was thrown”错误解决办法
  8. [技巧]把Excel里的数据插入到数据库里的方法
  9. http://doc.okbase.net/congcong68/archive/112508.html
  10. RTB撕开黑盒子 Part 4: Shady Bidding
  11. 结构-行为-样式-Angularjs-ngSanitize
  12. unity 看到Sphere内部,通过Sphere播放全景视频时候遇到的问题
  13. js 控制随机数生成概率
  14. 爬虫保存cookies时重要的两个参数(ignore_discard和ignore_expires)的作用
  15. node20180927
  16. PHP的json_encode()函数与JSON对象
  17. sqlserver查找使用了某个字段的所有存储过程
  18. DRF 权限和频率
  19. 【转】Dubbo和JDK的SPI究竟有何区别?
  20. 最大匹配字符串LCS,The Longest Common Substring

热门文章

  1. 牛客新年AK场之模拟二维数组
  2. Move-to-front(MTF) and Run-lenght encoding(RLE) algorithms
  3. 计算机二级-C语言-字符数字转化为整型数字。形参与实参类型相一致。double类型的使用。
  4. centsos 7 删除自带jdk安装自定义jdk8
  5. PB 数据窗口点击标题不能排序的一个原因
  6. flink整合kafka报错 WARN - Bootstrap broker ip:9092 disconnected
  7. Kubernetes的控制器之Deployment的定义
  8. 吴裕雄--天生自然Numpy库学习笔记:NumPy 数组属性
  9. C++11特性中基于范围的for循环
  10. 设计模式01 创建型模式 - 单例模式(Singleton Pattern)