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



TheHartfordAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pb_indiaCommented:
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.
0
pb_indiaCommented:
WHy did you give me grade C?
0
TheHartfordAuthor Commented:
Alright What grade do u require ? I just saw ur post and tried my code ,, it worked so i clicked the "Accept" button...
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

pb_indiaCommented:
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.
0
TheHartfordAuthor Commented:
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
0
pb_indiaCommented:
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

http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/Q_21192966.html#12494095

It might work.

Thank you for your kind efforts.

0
pb_indiaCommented:
Thanks!

Now I think you can accept the answer once more with Grade A.
I really appreciate your efforts.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.