[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Build dynamic query in C++

Posted on 2004-11-03
8
Medium Priority
?
307 Views
Last Modified: 2010-04-01
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



0
Comment
Question by:TheHartford
  • 5
  • 2
7 Comments
 
LVL 2

Expert Comment

by:pb_india
ID: 12483976
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
 
LVL 2

Expert Comment

by:pb_india
ID: 12484261
WHy did you give me grade C?
0
 

Author Comment

by:TheHartford
ID: 12484658
Alright What grade do u require ? I just saw ur post and tried my code ,, it worked so i clicked the "Accept" button...
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:pb_india
ID: 12485049
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
 

Author Comment

by:TheHartford
ID: 12494095
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
 
LVL 2

Expert Comment

by:pb_india
ID: 12495448
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
 
LVL 2

Accepted Solution

by:
pb_india earned 240 total points
ID: 12505081
Thanks!

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question