Select Top 1
-
I'm creating a report in Microsoft Reporting tool which uses VB.NET (which I don't know very well) I'm trying to select the Top 1 payment type but I can't get the syntax to work. I have =Top 1(Fields!paymenttype.Value) and it's not working, what would the correct expression be in VB.NET to pull the Top record? Thank you for any help!:confused:
-
I'm creating a report in Microsoft Reporting tool which uses VB.NET (which I don't know very well) I'm trying to select the Top 1 payment type but I can't get the syntax to work. I have =Top 1(Fields!paymenttype.Value) and it's not working, what would the correct expression be in VB.NET to pull the Top record? Thank you for any help!:confused:
What kind of an object are you getting the data from? And what version of Visual Studio do you use? If you are using a DataTable you could use
dtMyTable.Row(0)("PaymentType")
To access the "PaymentType" column in the very first record.dtMyTable.Row(1)("PaymentType")
To access the second record, and so on.) If you mean the greatest record, you would have to sort the data first, by which ever column you wish to sort by. You'd have to do the sorting in SQL or by using a DataView control. Does this help? -
I'm creating a report in Microsoft Reporting tool which uses VB.NET (which I don't know very well) I'm trying to select the Top 1 payment type but I can't get the syntax to work. I have =Top 1(Fields!paymenttype.Value) and it's not working, what would the correct expression be in VB.NET to pull the Top record? Thank you for any help!:confused:
-
I'm creating a report in Microsoft Reporting tool which uses VB.NET (which I don't know very well) I'm trying to select the Top 1 payment type but I can't get the syntax to work. I have =Top 1(Fields!paymenttype.Value) and it's not working, what would the correct expression be in VB.NET to pull the Top record? Thank you for any help!:confused:
-
I'm creating a report in Microsoft Reporting tool which uses VB.NET (which I don't know very well) I'm trying to select the Top 1 payment type but I can't get the syntax to work. I have =Top 1(Fields!paymenttype.Value) and it's not working, what would the correct expression be in VB.NET to pull the Top record? Thank you for any help!:confused:
I don't know exactly where you are trying to use the top statement, but it's certainly in the wrong place. The top statement should be placed directly after the select statement: select top 1 ... from ... where ... order by ... --- b { font-weight: normal; }
-
I don't know exactly where you are trying to use the top statement, but it's certainly in the wrong place. The top statement should be placed directly after the select statement: select top 1 ... from ... where ... order by ... --- b { font-weight: normal; }
-
Sorry for the delay, I was at work. What I realized I need is =Max(Fields!paymentcode) Thank you to everyone who responded, I'll try to be clearer next time.
I know you got the solution - but wanted to point out something - if the ONLY reason you are fetching the data is to get the top payment mode, then you should do it in the Select query and not after ALL the rows are fetched. Shreekar http://shreekarishere.blogspot.com