按月份查询数据,这是在.NET做的
int yer=DateTime.Now.Year;
int moon=DateTime.Now.Month;
conn=new SqlConnection("workstation id=ZERG1;packet size=4096;integrated security=SSPI;data source=ZERG1;persist security info=False;initial catalog=Northwind");
string sql="select * from biyesheji where datepart(yyyy,time1)="+yer+" and datepart(mm,time1)="+moon+"";
cmd=new SqlCommand(sql,conn);
SqlDataAdapter da=new SqlDataAdapter(cmd);
DataSet ds=new DataSet();
da.Fill(ds,"biyesheji");
dataGrid1.DataSource=ds;
dataGrid1.DataMember="biyesheji";
conn.Close();
声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。
- 上一篇: 使用css3做0.5px的细线
- 下一篇: TripleDES之C#和PHP之间加密解密