.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

select records within a week

Posted By:      Posted Date: September 26, 2010    Points: 0   Category :ASP.Net

i try to use select statement to select records within a week from orderdate. like,


"select * from order where orderdate <= DATEADD(day,7,orderdate)";


correct me if wrong.


View Complete Post

More Related Resource Links

dropdownbox which selects records based on criteria (TODAY, THIS WEEK, THIS MONTH, etc)


I have a dropdownbox which I want to use to search records based on a timescale. The gridview populates results based from that search.

So here is how I want to work this;

If a user selects "today" - a list of records input today are populated. If "this week" is selected, a list of all records added within that week from todays date is populated.

I created a forum on this issue previously but to no avail whatsoever. How do I work around this problem?

Help would be much appreciated

select records within 30 days of previous records

I have a table with a list of patient id's and there begin date and end dates as follows: ID     begin_date  end_date 1234 10/09/2009 10/16/2009 1234 12/16/2009 12/22/2009 1234 12/28/2009 12/30/2009 1234 01/13/2010 01/19/2010 1234 04/29/2010 05/05/2010 what i need to do is select the records that have an end_date within 30 days of a begin_date. So in the above example, i would need to get the following records: ID     begin_date   end_date 1234 12/28/2009   12/30/2009 1234 01/13/2010   01/19/2010 Because 12/28/2009 is 30 days within 12/22/2009 (previous end_date) and 01/13/2010 is within 30 days of 12/30/2009 (previous end_date) and 12/22/2009 (2nd previous end_date). is there a good way to do this using T-SQL?

Select random 10 records in sql server 2005 in terms of time

Hello,i have a query that select random records in access database in terms of time : "SELECT TOP 10 * FROM Tbl ORDER BY Rnd(-10000000*TimeValue(Now())*[ID])"now i wish to convert this query for using in sql server 2005 such that return random records in term of time 

How I select Start of week is Friday from date of Year ?

Hello everyone, I am tring to solve How i select Start date is Friday from week? Details for which i want to show I have dtmDate column in a query. from that date i display week of that date as per using (ww,dtmDate) as dtmWeek, and parameters are StartDate & EndDate Suppose I select StartDate as 1/1/2007 & End Date as 12/31/2007   I  do not want to show Output as: Weeks                      Column1          Column2 1/1/2007 (Thuesday)       5                     6 1/2/2007 (Wed)               4                     2 | | 1/5/2007  (Friday)            1                      8 1/6/2007 (Saturday)        7                     

SELECT Random Records in term of time



I want to return random records in term of time whithout NEWID

Select unique records, take the largest


Suppose, I have a table with the following data.   I need to be able to select the unique records from this table, on the LogicalHash column.  However, I need the select the largest by FileSize.   I can't quite figure out the correct SQL for this.   If I didn't have to worry about taking the largest file, I would just do this:

WHERE FileID in (
SELECT max(FileID) FROM files GROUP BY LogicalHash)


How do pick the largest file?  The file size is not going to be unique throughout the table, I can't select based on that.  Using cursors sounds like a bad idea.  I also need the SQL to be somewhat backwards compatible to MS Access.

Table: files

select certian records linq to sql


I have a database with a GUID and images,

one function

I want to get the first record (if exists) and return results


 second function

i want to get the second record only if a second record exists


I guess I have to return the records frmo the table then just movenext so to speak in a loop to select the second record but guessing there is a better faster way to do that in linq

I see some example for .take(1)  I assume that will always take the first record and return nothing else. I dont need this to be random. and what happens if there are no records return?

for the second function

I gues its  .skip(1).take(1)   will that for sure skip the first record and return the  second one to my var? again what if thier is no second record i would not want any results return if this is not the case (no scond record then want nothing back and no error)



Select Query to get records within last 24 hours in Nhibernate


Hi All

How to Retrive records within last 24 hrs using Nhibernate.
I want to retrieve the 10 records within last 24 hours.

How can i achieve this using Nhibernate.

Please Help.

Need to select records based on todays date


I need to select records in my database based on todays date. I have a date field that saves a future scheduled ship date for orders and need to use a select statement that would use todays date as a parameter. I am able to do this by manualy entering the date in the select statement but when I use todays date with inline code in the select statement it does not work. Please look at the code segment below:

Dim strTodaysDate As String
strTodaysDate = "'" + Date.Now.AddDays(9).ToString("MM/dd/yyyy") + "'"

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="<%$ ConnectionStrings:DAVINCIORDERTRACKINGConnectionString %>"
        SelectCommand="SELECT * FROM [OrderTracker] WHERE (CONVERT(char(10), ScheduledShipDate, 101) <> '<% =strTodaysDate %>')">


The segment above returns all records. And if I just enter the date manually in the select statement like below it returns the correct records:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="<%$ ConnectionStrings:DAVINCIORDERTRACKINGConnectionString %>"

Select number of records from table


I get records from the table by using "Select top(5) itemCode,ItemName,Price from Item"

Now I wan't to take next 5 records. How can I create query to that one.

After that I wan't to take the previous 5 records also.

AJAX GridView Checkbox Select All in ASP.Net

In the previous article GridView Select Multiple Rows you learnt the multiple row selection in GridView control. Here you will get the C# code sample to select all the gridview rows using single checkbox server control. You can highlight the selected rows with different color and Font state Bold. If you want to use the selection values on different ASP.Net

ASP.NET GridView - edit records using JQuery Dialog

There are many ways in which you could modify modular data in Grid View:
1. Inline by making rows editable when u click on Edit
2. By using separate pages for Edit
3. By using popups/dialogs for adding/editing

Select value in gridview


Hi, I am new to gridview. I want to make a gridview. Its row when selected should direct me to a specific .aspx page.Each row should direct to a different page. Should I use querystrings for this? Please suggest. Regards, ap.

adding XML 'records' with a key field


I have a vb.net Sub that is successfully adding 'records' to my XML file:

Private Sub btnSubmit_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnSubmit.Click             'for adding an XML 'record'
        Using ds As New DataSet()
            Dim dr As DataRow = ds.Tables(0).NewRow()
            dr("subject") = txtNewEvent.Text
            dr("year") = DateTime.Now.ToString("MM/dd/yy")
            txtNewEvent.Text = ""

how to increase Performance onloading page and navigation of records ?? Help








this is my aspx and cs code , let me know whether it is correct or not??

onload and performance on navigation of record show be good.

Plz help me

<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True"

                DisplayGroupTree="False" ReuseParameterValuesOnRefresh="true" HasToggleGroupTreeButton="False" Height="1039px" ReportSourceID="CrystalReportSource1"

                Width="901px" />

            <CR:CrystalReportSource ID="CrystalReportSource1" runat="

Showing filtered Records in Crystal Report as per User Requirement


ReportDocument reportDocument = new ReportDocument();
    ParameterField paramField = new ParameterField();
    ParameterFields paramFields = new ParameterFields();
    ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();
    protected void Page_Load(object sender, EventArgs e)
        if (!IsPostBack)
            paramField.Name = "@Ext";
            //*Remember to reconstruct the paramDiscreteValue and paramField objects
            paramDiscreteValue.Value = 44854
            CrystalReportViewer1.ParameterFieldInfo = paramFields;

FileID FileName LogicalHash DateModified FileSize
1 test.htm 00683b8eb1249ab232f83ab76148127a 11/17/2009 15002
2 document1.doc 00ebb79d95e13e71a0e93e9b82c2edd2 1/5/2008 55623
3 webpage.xml 00de966c7ae802ac9e508b4e0c15f893 10/2/2007
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend