txttimetxt.Value = DateTime.Now.ToString("yyyy-MM-dd");
string times =txttimetxt.Value.Trim();
DataSet ds = UsersLogin.GetDataSet("select a.UserID,RealName,UserType,b.Oid,TraveLine,Sections,c.Gid,c.SystemTime,Category,CarNumber,TrainNumber,Downtime,Repairstime,Renovatetime,Symptom,Effect,Result,c.CreateTime from dbo.Users as a left join dbo.OperationLine as b on a.UserID=b.UserID left join dbo.ProductionGuide as c on a.UserID=c.UserID where a.State=1 and b.State=1 and c.State=1 and c.SystemTime='" + times + "'");
gvSummary.DataSource = ds;
gvSummary.DataBind();
我的绑定数据的代码,麻烦要怎么写呢,拜托噢!
if(ds.Tables[0].Rows.Count == ))
{
DataRow row = ds.Tables[0].NewRow();
row[0] = "没有录入信息";
ds.Tables[0].Rows.Add(row);
}
谢谢了噢!我去试试
\
@一個亼冷暖自知: 这个方法可以谢谢了哈,但是不是我想要的效果不过也不错,呵呵,我稍微修下就OK了
还需要将你绑定的数据进行显示,ds.Table[0] //这里显示的是你表的第一列数据!
我这个绑定是按照时间加载的,假如今天25号没人提交,那么就没有数据的
有人提交就自动的可以加载出来了
@一個亼冷暖自知: 这样看来,你需要重新写一个判断程序。
if(GetData!="")//这里要判断今天是否有数据GetData=select data where time=DateTime.ToDay
{
DataSet ds = UsersLogin.GetDataSet("select a.UserID,RealName,UserType,b.Oid,TraveLine,Sections,c.Gid,c.SystemTime,Category,CarNumber,TrainNumber,Downtime,Repairstime,Renovatetime,Symptom,Effect,Result,c.CreateTime from dbo.Users as a left join dbo.OperationLine as b on a.UserID=b.UserID left join dbo.ProductionGuide as c on a.UserID=c.UserID where a.State=1 and b.State=1 and c.State=1 and c.SystemTime='" + times + "'");
gvSummary.DataSource = ds;
gvSummary.DataBind();
}
else
{
Response.Write(<script>alert('没有数据!')</script>);
}