- /// <summary>
- /// 根据类型得到配置列表
- /// </summary>
- /// <param name="paramType"></param>
- /// <returns></returns>
- public List<ParamTabInfo> LoadByType(string paramType)
- {
- string cmdText = "select ParamID,ParamText,ParamValue from ParamTab where ParamType = @ParamType";
- List<ParamTabInfo> list = new List<ParamTabInfo>();
- using (SqlConnection conn = new SqlConnection(Common.DBSettings.TestDBConnText))
- {
- conn.Open();
- SqlCommand cmd = new SqlCommand(cmdText, conn);
- cmd.Parameters.Add(new SqlParameter("@ParamType", System.Data.SqlDbType.NVarChar, 50));
- cmd.Parameters["@ParamType"].Value = paramType;
- using (SqlDataReader rdr = cmd.ExecuteReader())
- {
- while (rdr.Read())
- {
- ParamTabInfo info = new ParamTabInfo();
- info.ParamID = rdr["ParamID"].ToString();
- info.ParamText = rdr["ParamText"].ToString();
- info.ParamValue = rdr["ParamValue"].ToString();
- list.Add(info);
- }
- }
- }
- return list;
- }
复制代码 |