在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
public IList<Gname> GetReadFlei(int fid) { SqlParameter[] par = { new SqlParameter("@fid",fid), new SqlParameter("@RecordCount",SqlDbType.NVarChar,30) }; par[1].Direction = ParameterDirection.Output; SqlDataReader DR = SQLHelp.ExecuteReader("StroGetTest", CommandType.StoredProcedure, par); IList<Gname> List = new List<Gname>(); while (DR.Read()) { Gname sw = new Gname(); sw.id = DR.GetInt32(0); sw.gname = DR.GetString(1); sw.gdir = DR.GetString(2); sw.gfla = DR.GetString(3); List.Add(sw); } DR.Close(); this.Label1.Text = par[1].Value.ToString(); return List; }
public static SqlDataReader ExecuteReader(string cmdText, CommandType cmdType, params SqlParameter[] cmdParms)
{ 注意:cmd.Parameters.Clear()不能用,否用返回参数会被清空
CREATE PROCEDURE StroGetTest @fid int , @RecordCount NVarChar(30) Output AS SELECT @RecordCount=count(1) FROM gname WHERE fid=@fid; SELECT id,gname,gdir,gfla FROM Gname WHERE fid=@fid; GO
|
请发表评论