Key Points
When setting datasource, you must first clear the performanceid, which cannot both exist.
Sub date_selected () sub date_selected (byval sender as object, byval e as eventargs) handles calendar1.selectionchanged
Label1.visible = true
Label1.text = calendar1.selecteddate
Dim con as oledbconnection
Dim comm as oledbcommand
Dim strsql as string
Dim ODA as new oledbdataadapter
Dim oledata as Dataset
Dim mytable as string
Strsql = "select [log_id], [log_title], [log_intro], [log_content], [log_author], [log_postyear], [log_postmonth], [log_postday], [log_posttime], [log_weather], [log_cateid], [log_from], [log_commnums], [log_viewnums], [log_quotenums], [log_isshow] from [blog_content] Where [log_postyear] =? And [log_postmonth] =? And [log_postday] =? Order by [log_id] DESC"
Con = new oledbconnection ("provider = Microsoft. Jet. oledb.4.0; Data Source =" & server. mappath ("~ App_datap-blog.mdb "))
Comm = new oledbcommand (strsql, con)
Comm. Parameters. addwithvalue ("tyear", CINT (Year (calendar1.selecteddate )))
Comm. Parameters. addwithvalue ("tmonth", CINT (month (calendar1.selecteddate )))
Comm. Parameters. addwithvalue ("tday", CINT (Day (calendar1.selecteddate )))
ODA. selectcommand = comm
Oledata = new dataset
Mytable = "blog_content"
ODA. Fill (oledata, mytable)
Gridview1.performanceid = ""
Gridview1.datasource = oledata. Tables (mytable). defaultview
Gridview1.databind ()
End sub