SqlDataAdapter sda=new SqlDataAdapter(); sda.SelectCommand=new SqlCommand("select top 30 name,level,money,class from Info order by level DESC",con); DataSet ds=new DataSet(); sda.Fill(ds,"country"); this.DataGrid1.DataSource=ds; this.DataGrid1.DataBind(); con.Close(); } 其中class是我想绑定显示的,具体该怎么做 ?
select SendID,UserID,ClientName,
case Status
when '1'then '中国'
when '2' then '美国'
end as Status,
SendTime
from Send
where UserID=@userid
<%# CountryEnum[ (int) ((System.Data.DataRowView) Container.DataItem)["country"] ] %>在你的cs文件里面定义:
protected static string[] CountryEnum = new string[]{ "中国", "美国", …… };
谢谢
显示控件创建错误我的绑定是这样的
if(!this.IsPostBack)
{
SqlConnection con=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["CON2"]);
con.Open();
SqlDataAdapter sda=new SqlDataAdapter();
sda.SelectCommand=new SqlCommand("select top 30 name,level,money,class from Info order by level DESC",con);
DataSet ds=new DataSet();
sda.Fill(ds,"country");
this.DataGrid1.DataSource=ds;
this.DataGrid1.DataBind();
con.Close();
}
其中class是我想绑定显示的,具体该怎么做 ?
请问怎么给分的啊?我是小单,asp.net的菜菜,希望大家能多帮忙