Micro Focus QTP (UFT) Forums
Need help with QTP SQL ADO connection, value retrieved is different - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: Need help with QTP SQL ADO connection, value retrieved is different (/Thread-Need-help-with-QTP-SQL-ADO-connection-value-retrieved-is-different)



Need help with QTP SQL ADO connection, value retrieved is different - charanbc - 09-21-2012

I am writing a script to compare values in an excel file and values retrieved from a SQL database

The value in question is - "A the HR. (No Ad)"

The value is taken directly from SQL query and copied into the excel sheet for comparison purposes.
When I read the value from the excel sheet (also using OLEDB connection for Excel) it is displayed as

"A the HR. (No Ad)" (A)

But when I read the value from SQL using connection string the value is displayed as

"A the HR.(No Ad)" (B)

Even though the value in the DB is displayed correctly as (A) which is as expected using a query search.
For some reason when getting the value using connection string the space is removed from the string.

- If I remove the space using replace or trim the If A=B statement still fails (even though the 2 strings are now the same)
- I have tried searching for a vbCrlf in the string and removing it but still the condition fails.

Can anyone explain this wierd behaviour and give a solution?


Thanks,
Charan