日期:2014-05-18 浏览次数:20755 次
DateTime d_start = fee_date_starts.Value.Date; DateTime d_end = fee_date_ends.Value.Date.AddDays(1); sql_str = "select car_fee_nums as 会员卡号,car_fee_flag as 停车状态 from car_park_fee where car_fee_start between '" + d_start + "'and '" + d_end + "' order by car_fee_id desc"; if (DateTime.Compare(d_end, d_start) >= 0) { SqlConnection conn = new SqlConnection(fee_conn.sql_conn()); SqlCommand cmd = new SqlCommand(sql_str, conn); find_do = new SqlDataAdapter(); find_do.SelectCommand = cmd; ds = new DataSet(); try { find_do.Fill(ds, "rs"); d_report.Visible = true; } catch (System.Exception sqler) { MessageBox.Show("数据库不存在或用户名密码错误!"); return; } d_report.DataSource = ds.Tables["rs"]; }
那就在模板中使用用DropDownList来作为数据显示的控件 DropDownList1.DataTextField= "未停车..."; DropDownList1.DataValueField = "0,1,2"; 绑定你自己搞定,显示的时候文本用Text属性,相应的值保存在Value属性中,下次修改时直接获取DropDownList控件的SelectedItem.Value 即可获取到你想要的0,1,2啥的,明白??