.net - Select statement to display data for this week -


i want show data database in list view , want show data week , have statement current month :

public sub showlistview()         dim dt new datatable         dim ds new dataset     ds.tables.add(dt)     dim da new oledbdataadapter("select * pay_pretalk month(sdate)= date(now())", con)         da.fill(dt)         dim myrow datarow         each myrow in dt.rows             listview1.items.add(myrow.item(2))             listview1.items(listview1.items.count - 1).subitems.add(myrow.item(3))             listview1.items(listview1.items.count - 1).subitems.add(myrow.item(4))             listview1.items(listview1.items.count - 1).subitems.add(myrow.item(5))         listview1.items(listview1.items.count - 1).subitems.add(myrow.item(6))         listview1.items(listview1.items.count - 1).subitems.add(myrow.item(7))         next end sub 

i tried many thing nothing work :(

how can current week ??

try this

select * pay_pretalk datepart(week,sdate)=  datepart(week,getdate()) 

but beware, keeping functions in clause not efficient. if use function or stored procedure, save week number rhs of comparison in variable , use in query.

note: since did not mention database, assumed ms sql.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -