Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. A Doubt

A Doubt

Scheduled Pinned Locked Moved C / C++ / MFC
databasetutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rane
    wrote on last edited by
    #1

    can anyone helpme how to pass query values dynamically. (e.g) cin>>a; cin>>b; char szStr1[100]="Insert into region(regionId,RegionDescription)Values(????,????)" In what format I should supply the values (i.e) the values of a,b.(plz rewrite the above statement)

    P M 2 Replies Last reply
    0
    • R Rane

      can anyone helpme how to pass query values dynamically. (e.g) cin>>a; cin>>b; char szStr1[100]="Insert into region(regionId,RegionDescription)Values(????,????)" In what format I should supply the values (i.e) the values of a,b.(plz rewrite the above statement)

      P Offline
      P Offline
      Prakash Nadar
      wrote on last edited by
      #2

      you can put construct the query this way.. cin>>a; cin>>b; char szStr1[100]; sprintf(szStr1,"Insert into region(regionId,RegionDescription)Values(%d,%d)",a,b); My God is more powerfull Than Your God. (the line that divides the world)

      1 Reply Last reply
      0
      • R Rane

        can anyone helpme how to pass query values dynamically. (e.g) cin>>a; cin>>b; char szStr1[100]="Insert into region(regionId,RegionDescription)Values(????,????)" In what format I should supply the values (i.e) the values of a,b.(plz rewrite the above statement)

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #3

        #include <sstream>

        int a,b; // assume initialized from cin
        std::ostringstream strm;
        std::string s;

        strm << "Insert into region(regionID, RegionDescription)Values(" << a
        << "," << b << ")" << std::ends;
        s = strm.str();

        --Mike-- Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0! | RightClick-Encrypt "That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."   -- Buffy

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups