Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display text in ( ) in report column

Status
Not open for further replies.

frmorris

Programmer
Aug 4, 2005
22
0
0
US
I have the following line of code that is in asp. It is a report that has the following columns: Age, Name, Enrollment Date, and Closure Date.

dctReps.Item(strReportID).SelectedColumns = "dbo.CalculateAge(a.DateOfBirth,'" & Request.Form("txtEndDate") & "') as Age, a.Name, a.EnrollmentDate as 'Enrollment Date', a.ClosureDate as 'Closure Date'"


I need the Age column to say Age(in months). How do I add the (in months) part in the Age column. The rest of the columns were easy, all I had to do was add tick marks around what I wanted the column to say. However when I try to do the Age column like the rest, it does not work.


This is the error that I get when I change the Age column to as Age (in months)

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'Age'.

/reports/reportDisplay.asp, line 413

Any help will be appreciated. Thank you in advance.
 
Is this ASP.NET? Try forum855.

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
What type of object is referenced by the variable named dctReps?

... because you mention columns I assume it is some sort of grid but I don't really know.
 
Ok, sorry for the confusion... I was apparently reading too fast and just assumed it was .NET.

Your issue is that you cannot alias it to read "Age (in months)" even when you put the tics around it? Odd, that should enable it to do so. Your code looks like this:
Code:
dctReps.Item(strReportID).SelectedColumns = "dbo.CalculateAge(a.DateOfBirth,'" &  Request.Form("txtEndDate") & "') as [COLOR=red]'[/color]Age [COLOR=red](in months)'[/color], a.Name, a.EnrollmentDate as 'Enrollment Date', a.ClosureDate as 'Closure Date'"

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
So you have an object referencing a view on SQL server but what type of object is it?


[tt]SELECT 'foo' AS 'bar (hoppy)'[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top