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. Database & SysAdmin
  3. Database
  4. What is wrong???

What is wrong???

Scheduled Pinned Locked Moved Database
questioncomhelp
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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Could somebody explain why the following segment of the code is throwing exception in the last line. The error is -2146825069 (0x800A0C93) Remote ADO Error: The operation requested is not allowed in this context. //******************************************* _ConnectionPtr pConnection = NULL ; pConnection.CreateInstance(__uuidof(Connection)); _RecordPtr pRec = NULL ; pRec.CreateInstance(__uuidof(Record)); _bstr_t strConn2("Provider=MSDASQL;Driver={Microsoft Text Driver (*.txt; *.csv)}; DBQ=C:\\Temp" ) ; pConnection->Open(strConn2,"","",NULL); pRec->Open("1.txt", pConnection.GetInterfacePtr(), adModeReadWrite, adFailIfNotExists, adOpenRecordUnspecified, "", "" ) ; //******************************************* What is wrong??? Why I can't open simple text file through Record object??? Bob ( Expert_30@yahoo.com)

    M 1 Reply Last reply
    0
    • L Lost User

      Could somebody explain why the following segment of the code is throwing exception in the last line. The error is -2146825069 (0x800A0C93) Remote ADO Error: The operation requested is not allowed in this context. //******************************************* _ConnectionPtr pConnection = NULL ; pConnection.CreateInstance(__uuidof(Connection)); _RecordPtr pRec = NULL ; pRec.CreateInstance(__uuidof(Record)); _bstr_t strConn2("Provider=MSDASQL;Driver={Microsoft Text Driver (*.txt; *.csv)}; DBQ=C:\\Temp" ) ; pConnection->Open(strConn2,"","",NULL); pRec->Open("1.txt", pConnection.GetInterfacePtr(), adModeReadWrite, adFailIfNotExists, adOpenRecordUnspecified, "", "" ) ; //******************************************* What is wrong??? Why I can't open simple text file through Record object??? Bob ( Expert_30@yahoo.com)

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

      Hi Bob, i have done the following and it works: _ConnectionPtr pConnection = NULL ; pConnection.CreateInstance(__uuidof(Connection)); _RecordsetPtr pRec = NULL ; pRec.CreateInstance(__uuidof(Recordset)); _bstr_t strConn2("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\Northwind.mdb") ; pConnection->Open(strConn2,"","",NULL); pRec->Open("SELECT * FROM [Text;Database=c:\\Temp;HDR=YES;FMT=Delimited].[1.txt]", pConnection.GetInterfacePtr(), adOpenStatic, adLockReadOnly, adCmdText); int nCount = pRec->GetRecordCount(); The data: "Praefix";"Trennung" "acco";5 "asso";5 "comm";5 "comp";5 "conc";5 "conf";5

      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