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

Top 5 Contributors of the Month
Post New Web Links

Selecting current,previus month values

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

hi friends,

consider that i have columns like tax_amount,item_amount,month,year in a table..

i want to get

current month & year - tax_amount,item_amount

previus month and current year- tax_amount,item_amount

current month &  previus year - tax_amount,item_amount

how to get all the values in a single select query.

i am waiting for ur reply..

View Complete Post

More Related Resource Links

How i can view last 5 days records in current Month

Suppose i have a tableAppno Receive_Date Send_Date 1 9/3/2010 9/3/2010 2 9/3/2010 null 3 9/4/2010 9/4/2010 4 9/9/2010 9/9/2010 i m trying to run this select * from search where datediff(d,send_Date,getdate()<5

How to Get Values from Current Row of a gridview

hallo all.. how can i access my gridview so that i can get the current row column values..pls help me

How to Correlate Last weekday of previous Month and First Weekday of current Month ? - T-SQL 2005

Hi friends, below is my detail description. I woulld like to show busines users Previous Months Last Weekday in Drop Down List as a Parameter. Now, if they select Previous Months Last Weekday, then i need to pass First weekday of Current month. How can i correlate this things ? if you need more information, let me know.   Thanks.

Selecting Unique Combinations of multiple row values



I have a table called 'Permutations' that lists every single combination of 5 numbers that could be selected from numbers 1 to 10.

(the first few rows are as follows, there are 30240 in total):


Number 1| Number 2| Number 3| Number 4| Number 5|

1 | 2 | 3 | 4 | 5

2 | 3 | 4 | 5 | 1

3 | 4 | 5 | 1 | 2

4 | 5 | 1 | 2 | 3

5 | 1 | 2 | 3 | 4

2| 3 | 4 | 5 | 6

3 | 4 | 5 | 6 | 2


and so on.


I want to write a query that only returns the unique combinations of these. So, from the rows provided above, the only rows that the query would return would be

Number 1| Number 2| Number 3| Number 4| Number 5|

1 | 2 | 3 | 4 | 5
2 | 3 | 4 | 5 | 6

Is there an easy way of doing this (note that the correct query would return 252 rows)?


How to execute a formula through all children measure's values in the current context


Hi, I have a cube with the following dimensions and measures:


The [Answer] measure is a integer value between 0 and 10.
My goal is to create a custom calculated member that return's the answer that
most appears in the current context. I don't know the correct math function's
name in english, but in portuguese is called as "MODA".

I've used the following sintaxe to calculate the STDEVP and I need to
reproduce some similar behavior that the STDEVP internaly's uses to navigate
through all children values and calculate the standard deviation:
STDEVP( [DimAnswer].Children, [Measures].[Answer])

Could someone please help me?

Oberdan Borges Nunes

MDX to pick the data from first day of the current month



I need to make a mdx query to pick the data from first day of the current month.

SELECT [Measures].[Internet Sales Amount] ON COLUMNS,

[Date].[Fiscal].[Date].MEMBERS ON ROWS

FROM [Adventure Works]


The above query returns around 4 years of data, but I need the data from first day of the current month.


Could anybody help me out!!!






SPD 2010 reusable workflow not picking up Current Item values


Hi, I have created an SPD 2010 reusable workflow that is attached to a specific content type...such content type is derived from a published InfoPath form with some of its fields being promoted, like the "Approvers" fields.

In SPD 2010, I add the " Start Approval process on Current Item with 'Participants' " action...those Participants I get (or at least I want to) from the Current Item: ApproversField.

After saving and publishing the workflow, I use the content type (set as default) in a form library and then add the workflow to it. After creating an Item the workflow is automatically rejected.

I checked the Workflow History and I realized the participants are not being picked from the current item's field... weird thing is, if I try the very same actions/etc in a workflow that is attached to that list everything works perfect... I tried to log messages all around the workflow process but the values never get picked up...

What am I missing here?

Thanks in advance.

Populating listbox2 values after selecting item of listbox1 in Infopath



In Infopath I have two listboxes say listbox1,listbox2.In listbox1 i have the items of list,now my requirement is as soon as i select first item in listbox1,listbox2 values should get populated from other.Please share me your ideas/relevant articles that you have

Thanks & Regards,


Thanks & Regards, Sudheer

getting values of month in a control


<form id="form1" runat="server">
    <input type="hidden" id="hdnDay" runat="server" />
    <asp:DropDownList ID="ddlMonth" runat="server" onchange

SPQuery to get all Items Modified in Current Month/Year


I have a SharePoint List. Using CAML I need get all the Items that are modified in the current Month/Week/Year.? 

Can anybody help me to achieve this?




Selecting Returning values from sql database in asp.net 2.0 codebehind and c#



 Is there a way of selecting returned values from a call to an sql database in the code behind? For example assume that I used the following to select values from a table called Products;


              SELECT  Price, Qty, Numbersold FROM Products


How can I now get the returned values e.g.  Price  in the c# codebehind and display it in a textbox? I know that in the asp markup that I can use EVAL and Bind statements to do this for example I can do Eval("Price")  but is there a way of getting any of the selected values (Price, Qty or Numbersold)  in the codebehind?

I know that I can use three separate select statements and  make three separate calls to return each value and then do something like the following

Price = Convert.ToInt32(myCommand.ExecuteScalar());


But using three separate calls is very inefficient!






Need YTD when pulling only current Month detail.



I have report in reporting services that shows Sales for the Current  "Fiscal Period In Year" Which would be the 4 weeks of this month.  This is then compared to last years sales for the same Period. Now, my problem is , if i filter this mdx query by period, then I cannot get the YTD value . How do i get a the YTD, if im filtering the rest of the query down to the Current Period?


 I originally used the code below and then just filtered the groups in the report to only show the current period. This works, but the report is very slow because of the Query pulling all sales.  I know there has to be an easier and more efficient way to get this running with the YTD without needing all the detail rows.




 SELECT NON EMPTY { [Measures].[PL Gross Sales Amt] } 

 ON COLUMNS, NON EMPTY { ([Time].[Fiscal Week].[Fiscal Week].ALLMEMBERS 

 * [Sell To Customer].[State].[State].ALLMEMBERS 

 * [Time].[Fiscal Year].[Fiscal Year].ALLMEMBERS 

 * [Time].[Fiscal Period In Year].[Fiscal Period In Year].ALLMEMBERS 

 * [Sell To Customer].[Customer].[Customer].ALLMEMBERS 

 * [Sell To Customer].[Customer C

Trouble getting current month



I'm trying to get Current month unique ID to return as a default parameter value for reporting services parameter.


I try it like this:


MEMBER [Measures].[CurrentMonth] 
SetToStr(EXISTS([Date].[Month].[Month].ALLMEMBERS,Filter([Date].[Date].ALLMEMBERS, [Date].[Date].MemberValue = vba![Date]())))

SELECT {[Measures].[CurrentMonth]} ON COLUMNS

FROM [Cube]

that works, but returns it in a set format ({[...]})

however, as soon as I try to get a single member out of it (it's only a single member there anyway!), I get NULL. No metter if I try Item(0).MemberValue, or .CurrentMember, or MemberToStr, I always get NULL.


What am I doing wrong?

MDX to compare current month's revenue with last month revenue?


Hi I have SSAS 2008 cube and PPS 2007.

I created two NAMED SET : [This Month] and [Last Month]. Now I would like to calculate member which compare current month’s revenue with last month revenue like
[Revenue Difference] = [This Month] - [Last Month] revenue &
[Revenue Difference %] = [This Month] - [Last Month] revenue in percentage.

I would like to create MEMBERS/SET/SCOPE(not sure which is right one?) for just drag-and-drop to cube browser? Any SSAS 2008 MDX please.Thank You....

how to filtering the autocomplete textbox values while selecting perticuler value in dropdown.


in my applicaion dropdown having country,state ,district  values  and one autocomplete textbox  , if i select country in the dropdown  only country names should be filtering in autocomplete textbox ..........can anybody tell me

thanks in advance


Filtering repeating section values based on selecting a value from dropdown


I have a repeating section in InfoPath 2010 which has questions associated to certain levels. The questions with associated levels are coming from Sharepoint 2010 list.

I also have a dropdown  where user can select which  level question they want to see.

I have tried few things here.

(1)Written code in c# on change of this dropdown to populate  the questions in the repeating section only if the level is what the user has selected.

It works perfectly fine on the client side but when I publish it as a form template onto SharePoint 2010 all the questions show up without any filtering.

appreciate any insights.

(2)I have also tried using conditional formatting, adding rules to hide the control(repeating section) if the questions level is no equal to the level selected in drop down. This also works gr8 on client side but not when published to Share point as browser enabled form template.


Can anyone tell me why this might be happening?


Creating Sites/Lists/List Items under Current User Context in SharePoint By Using SPUserToken

Usually we do this by performing the action under RunWithElevatedPrivileges method and updating the listitem using SPListItem.SystemUpdate() method (see here). but this approach has its own flaws like (RunWithElevatedPrivileges will run under system account, we cannot use SystemUpdate for SPSite,SPWeb,SPList, since it runs under system we will "CreatedBy" by as SystemAccount).
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