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. ERROR IN FROM CLAUSE

ERROR IN FROM CLAUSE

Scheduled Pinned Locked Moved C / C++ / MFC
databasehelplearning
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.
  • S Offline
    S Offline
    Shouvik Das
    wrote on last edited by
    #1

    I'm using a ODBC connectivity with a DB in an SDI appl. I retrieve data from the dlg box n on closing of the box i'm updating the data to the DB using

    query="insert into Book values('"+ad.m_Auto_Ac_No+"','"+ad.m_Add_Name+"','"+ad.m_Add_Auth+"',"+temp+","+ad.m_Add_Price+",'"+ad.m_Add_Date+"',"+locstat+")";
    m_pSet->Open(CRecordset::dynaset,(LPCTSTR)query,CRecordset::none);
    

    whr m_pSet is a Crecordset object. This returns an error as Syntax error in FROM clause whereas i'm nowhere using any data retrieval operation. :confused: pl help


    Man can acquire accomplishments or he can become an animal, whichever he wants. God makes the animals, man makes himself. G. C. Lichtenberg (1742-99), German physicist, philosopher. SH:)UVIK

    C S 2 Replies Last reply
    0
    • S Shouvik Das

      I'm using a ODBC connectivity with a DB in an SDI appl. I retrieve data from the dlg box n on closing of the box i'm updating the data to the DB using

      query="insert into Book values('"+ad.m_Auto_Ac_No+"','"+ad.m_Add_Name+"','"+ad.m_Add_Auth+"',"+temp+","+ad.m_Add_Price+",'"+ad.m_Add_Date+"',"+locstat+")";
      m_pSet->Open(CRecordset::dynaset,(LPCTSTR)query,CRecordset::none);
      

      whr m_pSet is a Crecordset object. This returns an error as Syntax error in FROM clause whereas i'm nowhere using any data retrieval operation. :confused: pl help


      Man can acquire accomplishments or he can become an animal, whichever he wants. God makes the animals, man makes himself. G. C. Lichtenberg (1742-99), German physicist, philosopher. SH:)UVIK

      C Offline
      C Offline
      Chris Maunder
      wrote on last edited by
      #2

      Firstly we can't tell what values you are pumping into the SQL statement, and secondly never, ever, EVER do what you are doing. Your app is open to SQL injection attacks. Use parameters and check the input values going into the query.

      cheers, Chris Maunder

      CodeProject.com : C++ MVP

      1 Reply Last reply
      0
      • S Shouvik Das

        I'm using a ODBC connectivity with a DB in an SDI appl. I retrieve data from the dlg box n on closing of the box i'm updating the data to the DB using

        query="insert into Book values('"+ad.m_Auto_Ac_No+"','"+ad.m_Add_Name+"','"+ad.m_Add_Auth+"',"+temp+","+ad.m_Add_Price+",'"+ad.m_Add_Date+"',"+locstat+")";
        m_pSet->Open(CRecordset::dynaset,(LPCTSTR)query,CRecordset::none);
        

        whr m_pSet is a Crecordset object. This returns an error as Syntax error in FROM clause whereas i'm nowhere using any data retrieval operation. :confused: pl help


        Man can acquire accomplishments or he can become an animal, whichever he wants. God makes the animals, man makes himself. G. C. Lichtenberg (1742-99), German physicist, philosopher. SH:)UVIK

        S Offline
        S Offline
        S Douglas
        wrote on last edited by
        #3

        This type of question would probrally get a better answer in the SQL forum. Expanding on what Chris said read this article SQL Injection Attack[^] for more information. Your really opening up the entire db to malice. See the W3Schools for info on how the Insert Into Statement[^] works. INSERT INTO table_name (column1, column2,...) VALUES (value1, value2,....) Good Luck!


        I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:

        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