views:

233

answers:

1

hi

i have database that connect to crystal report. i have only one field. how i can print this field in 2 column

ex:

col1 ---- clo2

1 --------- 4

2 --------- 5

3 --------- 6

thank's in advance

A: 

Hi, if the value of the column is int you can do it with select from database like this

SELECT
      case WHEN value / 2 = 0 THEN value ELSE null END AS col1,
      case WHEN value / 2 = 1 THEN value ELSE null END AS col2
FROM table

If i haven't understand the problem please explain more. Also you can bind crystal reports to ADO .Net dataset then you can do this split in you code using a loop.

Best Regards, Iordan

IordanTanev
thank's for the help, what i mean is that i have database that has one field, and i want to split this field in crystal report to 2 columns that will shows in the page
Gold
The you can create in your c# you can create DataTable with two columns and then loop through the data selected from the DB and put the value from the value into first or second column, Then put this DataTable into DataSet and use the DataSet as DataSource for the crystal report. This is the best thing to do. Best Regards, iordan
IordanTanev