按月份查询数据,这是在.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();
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇:没有了
- 下一篇:没有了
