数据库 money float 后台 Decimal double

    protected void Button1_Click(object sender, EventArgs e)
    {
        string sql = "insert into aa values(@a,@b)";
        SqlParameter[] parms ={
            new SqlParameter("@a",SqlDbType.Money),
            new SqlParameter("@b",SqlDbType.Float)
        };
        parms[0].Value = this.TextBox1.Text;
        parms[1].Value =this.TextBox2.Text;

        SqlHelper.ExecuteNonQuery(SqlHelper.sqlstr, CommandType.Text, sql, parms);
        Response.Write("成功");
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        List<Class1> clss = new List<Class1>();
        using (SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.sqlstr, CommandType.Text, "select *from aa", null))
        {
            while (dr.Read())
            {           
                Class1 cls = new Class1(dr.GetDecimal(0), dr.GetDouble(1));
                clss.Add(cls);
            }
        }
        this.GridView1.DataSource = clss;
        this.GridView1.DataBind();
    }

 private decimal _m;
    public decimal m
    {
        get
        {
            return _m;
        }
        set
        {
            _m = value;
        }
    }
    private double _f;
    public double f
    {
        get
        {
            return _f;
        }
        set
        {
            _f = value;
        }
    }
 public Class1()
 {

 }
    public Class1(decimal m_m, double m_f)
    {
        _m = m_m;
        _f = m_f;
    }

posted on 2007-12-20 12:42 top15from_old1 阅读(...) 评论(...) 编辑 收藏

导航

公告

随州简爱保罗定制衣柜专卖店为您准备了全套家装所需的定制家具,用工厂直销的价格和衣柜行业领导品牌的实力恭候您的光临。 随州市清河路清河丽景大门右侧18307228966 0722-3594778