CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2009
    Posts
    68

    insert to database from visual c++

    i have built aplication to insert data from database. i have two variables they are m_UserName and m_Password.

    my code like this :


    CDatabase db;

    db.OpenEx(_T("DSN=billing test; UID = root"),CDatabase::noOdbcDialog);
    db.ExecuteSQL("INSERT INTO user VALUES ('m_UserName' , 'm_Password')");

    why were data inserted in my database m_UserName and m_Password? not the value of that variable? if i want to insert the value of the variable, what should i do?

    thanks for every think....

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: insert to database from visual c++

    Because you used string literals instead of variables in your code.

  3. #3
    Join Date
    Aug 2009
    Posts
    68

    Re: insert to database from visual c++

    ok. thanks...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured