public XianModel Postxian (FenModel Model) { the SqlCommand COM = conn.CreateCommand (); // Type com.CommandType = CommandType.StoredProcedure; // stored procedure names com.CommandText = " Xian " ; // storage conditions during // The total number of the output parameter is to be noted that the SqlParameter [] = sqls new new the SqlParameter [] { new new the SqlParameter the ParameterName = { " YE " , as SqlDbType = SqlDbType.Int, SqlValue =model.ye }, new SqlParameter{ParameterName="tiao",SqlDbType=SqlDbType.Int,SqlValue=model.tiao }, new SqlParameter{ParameterName="zong",SqlDbType=SqlDbType.Int,Direction=ParameterDirection.Output } }; //添加进去 com.Parameters.AddRange(sqls); //实例化适配器 SqlDataAdapter sda = new SqlDataAdapter(com); DataTable dt = new DataTable(); sda.Fill(dt); //To find the total number of int Zong = Convert.ToInt32 (com.Parameters [ " Zong " ] .Value); // instantiate XianModel Xian = new new XianModel { dt = dt, Zong = Zong }; return Xian; }
Api stored procedures (paging)
Guess you like
Origin www.cnblogs.com/Zhangbao001/p/12160156.html
Recommended
Ranking