Query the codes of blogs of different dates in a blog

Source: Internet
Author: User

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

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.