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. CRecordset and SQL problem

CRecordset and SQL problem

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelpdatabase
2 Posts 1 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
    Stefan Dahlin
    wrote on last edited by
    #1

    Hi I have a SQL question that looks something like this: "SELECT DISTINCTROW Table1.strDate AS strDateEx, Sum(Table1.dfValue) AS dfValueEx FROM Table1 GROUP BY Table1.strDate;" What i want to do is that i have a table with dates. And i want one row for each day with the sum for that day in the dfValueEx column. I have no problem on getting the question to work when i try it in Access. My problem is that i don't know how i could make this work in a CRecordset. When i try i get a "Invalid character value for cast specification on column number 1 (strDate)" error. What does this error mean, and how can i get this to work?

    S 1 Reply Last reply
    0
    • S Stefan Dahlin

      Hi I have a SQL question that looks something like this: "SELECT DISTINCTROW Table1.strDate AS strDateEx, Sum(Table1.dfValue) AS dfValueEx FROM Table1 GROUP BY Table1.strDate;" What i want to do is that i have a table with dates. And i want one row for each day with the sum for that day in the dfValueEx column. I have no problem on getting the question to work when i try it in Access. My problem is that i don't know how i could make this work in a CRecordset. When i try i get a "Invalid character value for cast specification on column number 1 (strDate)" error. What does this error mean, and how can i get this to work?

      S Offline
      S Offline
      Stefan Dahlin
      wrote on last edited by
      #2

      Strange, a few minutes after i posted the question i got a step further. As it is now i have all my dates as strings in the database, and tried to use RFX_Text to bind a CString to that column to get the value. It seems that the result of a Table1.strDate AS strDateEx is a Date/Time column, at least i think it is. Becuase when i used RFX_Date i didn't get the error that i got previous. But instead i get "Error retrieving record.". So i still have some problems and could really need som help.

      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