Link to home
Start Free TrialLog in
Avatar of TheHartford
TheHartford

asked on

Build dynamic query in C++

hello experts,

I am getting used to code in C++, so not so strong ...here is what i am having trouble with. I have a SQL select stmt in which i need to pass a String var as a concatenttion to complete the qry based on values passed to the column. An example of what i am talking abt is :

Eg:

Original SQL in the ap:

sqry = "SElect col1,col2,col3 from table A where col1 = something and col2 = something"

Now the requirement is :

I have built a string like

str = " And col3 in ( "A") ";

I need to add the above "str" in the prev qry in the end .

Any help in this will be greatful

Thanks
Ramesh



Avatar of pb_india
pb_india

is sqry a string variable?

You can try this:

sqry= sqry +str;

If sqry  is a char* or char[], use strcat(char*, char*); API

If not, please put more code so I can help you.
WHy did you give me grade C?
Avatar of TheHartford

ASKER

Alright What grade do u require ? I just saw ur post and tried my code ,, it worked so i clicked the "Accept" button...
If my answer helped you then I would appreciate a deserved grade.
If it did not and you were not satisfied, I don;t mind.

Allthough I would hvae liked to get an "A".
Thanks and Good Luck.
Is there a way to change the grade,..I will more than happy to do that..i dont how do it ..show me the way and i change it...

Thanks
I think if you just put a not in Subject

"Reopen question, want to change grade"

and in the Body send the URL to the concerned question which is as below

https://www.experts-exchange.com/questions/21192966/Build-dynamic-query-in-C.html#12494095

It might work.

Thank you for your kind efforts.

ASKER CERTIFIED SOLUTION
Avatar of pb_india
pb_india

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