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. CDatabase & CRecordset

CDatabase & CRecordset

Scheduled Pinned Locked Moved C / C++ / MFC
question
2 Posts 2 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.
  • D Offline
    D Offline
    Drawil
    wrote on last edited by
    #1

    Hello every body I am using a CRecordset object but I want to make my own connection string, not defult,so how can i make this? is it don by using CDatabase Object and how? Best Regards :)

    M 1 Reply Last reply
    0
    • D Drawil

      Hello every body I am using a CRecordset object but I want to make my own connection string, not defult,so how can i make this? is it don by using CDatabase Object and how? Best Regards :)

      M Offline
      M Offline
      Mazdak
      wrote on last edited by
      #2

      If you are using access you can just give file path or if you use ODBC driver this is another example:

      CDatabase aDB;

      try
      {
      aDB.OpenEx("DSN=MyDSN");
      // Specify login information if using SQL Server authentication,
      // e.g., aDB.OpenEx("ODBC;DSN=MyDSN;UID=sa;PWD=");

      CRecordset aRS(&aDB);

      aRS.Open(CRecordset::forwardOnly,
      "SELECT DISTINCT state FROM authors");
      .
      .
      .
      .

      or another example for SQLServer(without ODBC) this is a connection string:

      Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=NorthWind;Data Source=MAZY;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=MAZY;Use Encryption for Data=False;Tag with column collation when possible=False

      Mazy "So,so you think you can tell, Heaven from Hell, Blue skies from pain,... How I wish,how I wish you were here."
      Wish You Were Here-Pink Floyd-1975

      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