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. how to create a user name and password for a database ?

how to create a user name and password for a database ?

Scheduled Pinned Locked Moved C / C++ / MFC
databasehelptutorialquestion
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.
  • V Offline
    V Offline
    vcseeker
    wrote on last edited by
    #1

    Hi, can any body help me in creating a username and password for the database programmatically.I am connecting to the database like this: CString sDriver = "MICROSOFT ACCESS DRIVER (*.mdb)"; CString sDsn; TCHAR sError[100]; sDsn.Format(_T("ODBC;DRIVER={%s};DSN='';DBQ=%s"),sDriver,sDatabase); try { m_pDatabase->Open(NULL,false,false,sDsn); } catch(CDBException* e) { e->GetErrorMessage(sError,100); AfxMessageBox(sError); } :confused:

    S A 2 Replies Last reply
    0
    • V vcseeker

      Hi, can any body help me in creating a username and password for the database programmatically.I am connecting to the database like this: CString sDriver = "MICROSOFT ACCESS DRIVER (*.mdb)"; CString sDsn; TCHAR sError[100]; sDsn.Format(_T("ODBC;DRIVER={%s};DSN='';DBQ=%s"),sDriver,sDatabase); try { m_pDatabase->Open(NULL,false,false,sDsn); } catch(CDBException* e) { e->GetErrorMessage(sError,100); AfxMessageBox(sError); } :confused:

      S Offline
      S Offline
      sorenb
      wrote on last edited by
      #2

      I'm not sure about Access but isn't this accomplished using something like: GRANT CONNECT TO FRED IDENTIFIED BY SESAME BTW, why don't you just: e->ReportError(); instead of e->GetErrorMessage(sError,100); AfxMessageBox(sError); Rgds, S. Bro

      1 Reply Last reply
      0
      • V vcseeker

        Hi, can any body help me in creating a username and password for the database programmatically.I am connecting to the database like this: CString sDriver = "MICROSOFT ACCESS DRIVER (*.mdb)"; CString sDsn; TCHAR sError[100]; sDsn.Format(_T("ODBC;DRIVER={%s};DSN='';DBQ=%s"),sDriver,sDatabase); try { m_pDatabase->Open(NULL,false,false,sDsn); } catch(CDBException* e) { e->GetErrorMessage(sError,100); AfxMessageBox(sError); } :confused:

        A Offline
        A Offline
        Alexander M
        wrote on last edited by
        #3

        read msdn "SQLDriverConnect (Access)" there you will see, that the UID and PWD keywords are supported... use sDsn.Format(_T("ODBC;DRIVER={%s};DSN='';DBQ=%s;UID=%s;PWD=%s"),sDriver,sDatabase,sUser,sPass); i don't know if this works, it's just an idea. good luck Don't try it, just do it! ;-)

        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