Link to home
Start Free TrialLog in
Avatar of ArunVashist
ArunVashistFlag for India

asked on

visual C#, Crystal reporting, unbound field

Hi Friends,

I am developing a windows application using C# in VS 2008, now i am creating a Crystal report with unbound field and pass a string value at runtime. now the issue is when I type string directly as shown below it shows report properly :

rpt.DataDefinition.FormulaFields["ubsPatientName"].Text = "\"some text to show\"";

but when I pass a value of datarow as given below it never show anything

DataRow dr = dsTemp.Tables["PatientById"].Rows[0];
rpt.DataDefinition.FormulaFields["ubsPatientName"].Text = dr["FirstName"].ToString();

I think its just because of "\" character which is not present in second case, but I don't exactly know the purpose of "\" and how to add this to string. please guide.

thanks.
ASKER CERTIFIED SOLUTION
Avatar of James0628
James0628

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of James0628
James0628

Good point about the single-quotes.  I just knew that quotes seemed to be required by something.  I didn't really know where they were actually being used (in the code that runs the report or in the report itself).  If the quotes are just being passed along to CR, then single quotes should be fine, and a bit easier to use (no \" stuff).

 James
Avatar of ArunVashist

ASKER

Hi,

I am accepting solution as suggested by James0628 and mlmcc as both solutions works find for me but assigning James0628 for his early reply and mlmcc for making point more clear to me.

thanks
You're welcome.  Glad I could help.

 James