zoukankan      html  css  js  c++  java
  • ado显示下拉

    string comStr = "Data Source=.;Initial Catalog=A2;Integrated Security=True";
    public List<Menber> MenberShow()
    {
    using (var conn = new SqlConnection(comStr))
    {
    //打开数据库链接
    conn.Open();
    var cmd = conn.CreateCommand();
    cmd.CommandText = "select * from Menber a join Setting b on a.MenberTypeId=b.SettingId";
    DataTable dt = new DataTable();
    SqlDataAdapter da = new SqlDataAdapter(cmd);
    da.Fill(dt);
    var Shoplist = new List<Menber>();
    foreach (DataRow dr in dt.Rows)
    {
    var m = new Menber();
    m.MenberId = Convert.ToInt32(dr["MenberId"]);
    m.MenberCard = Convert.ToInt32(dr["MenberCard"]);
    m.MenberTypeId = Convert.ToString(dr["MenberTypeId"]);
    m.MenberGrade = Convert.ToString(dr["MenberGrade"]);
    m.MenberType = Convert.ToString(dr["MenberType"]);
    m.SettingGrade = Convert.ToString(dr["SettingGrade"]);
    m.MenberName = Convert.ToString(dr["MenberName"]);
    m.MenberPhone = Convert.ToString(dr["MenberPhone"]);
    m.Cumulative = Convert.ToDecimal(dr["Cumulative"]);
    m.Storage = Convert.ToDecimal(dr["Storage"]);
    m.Accumulative = Convert.ToDecimal(dr["Accumulative"]);
    m.Integral = Convert.ToInt32(dr["Integral"]);
    m.Activate = Convert.ToDateTime(dr["Activate"]);
    m.Expiration = Convert.ToDateTime(dr["Expiration"]);
    m.Condition = Convert.ToBoolean(dr["Condition"]);
    Shoplist.Add(m);
    }
    return Shoplist;
    }
    }
    //绑定品牌列表下拉框
    public List<Setting> Brands()
    {
    using (var conn = new SqlConnection(comStr))
    {
    conn.Open();
    var cmd = conn.CreateCommand();
    cmd.CommandText = "select * from Setting";
    DataTable dt = new DataTable();
    SqlDataAdapter da = new SqlDataAdapter(cmd);
    da.Fill(dt);
    var Brands = new List<Setting>();
    foreach (DataRow dr in dt.Rows)
    {
    var m = new Setting();
    m.SettingId = Convert.ToInt32(dr["SettingId"]);
    m.MenberType = Convert.ToString(dr["MenberType"]);
    m.SettingGrade = Convert.ToString(dr["SettingGrade"]);
    Brands.Add(m);
    }
    return Brands;
    }
    }

  • 相关阅读:
    思岚 激光雷达 A3 使用官方sdk读取数据
    思岚激光雷达 开箱使用
    ubuntu 更新软件失败
    ubuntu 安装tftp
    Ubuntu 安装Telnet服务
    【博客搬至CSDN】
    【RabbitMQ】一文带你搞定springboot整合RabbitMQ涉及消息的发送确认,消息的消费确认机制,延时队列的实现
    基于JVisualVM的可视化监控
    LCN解决分布式事务原理解析+项目实战(原创精华版)
    springboot 用监听器统计在线人数案例分析
  • 原文地址:https://www.cnblogs.com/zhang2000/p/13253808.html
Copyright © 2011-2022 走看看