The SSRS CStr is a Conversion function that converts the given field or expression to a string. The syntax of the CStr function for converting to string type is as shown below.
CStr(Fields!Income.Value)
CStr(Fields!HireDate.Value)
To demonstrate the CStr function in reporting services, we use the Employee table below, which has 20 records. The image shows the records in the Table report.
SSRS CStr function Example
For this, let me add a new column to the right side of the BirthDate column. Next, right-click the textbox under the CStr and choose the Expression to open the expression window shown below. The CStr expression below will convert the BirthDate column values to string type.
=CStr(Fields!BirthDate.Value)
Similarly, let me create one more new column to convert the YearlyIncome values to a string datatype. The SSRS CStr function expression to perform the same is shown below.
=CStr(Fields!YearlyIncome.Value)
Please click the preview tab to see the CStr report.