Click here to Skip to main content
15,910,981 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Coding Dilemma Pin
perlmunger19-Jun-02 9:26
perlmunger19-Jun-02 9:26 
GeneralRe: Coding Dilemma Pin
Michael P Butler19-Jun-02 9:26
Michael P Butler19-Jun-02 9:26 
GeneralRe: Coding Dilemma Pin
Nic Oughton20-Jun-02 0:37
professionalNic Oughton20-Jun-02 0:37 
Generallisting printer trays Pin
pnpfriend19-Jun-02 4:25
pnpfriend19-Jun-02 4:25 
Generalget to the top of a file Pin
Steve L.19-Jun-02 3:24
Steve L.19-Jun-02 3:24 
GeneralRe: get to the top of a file Pin
Niklas L19-Jun-02 3:36
Niklas L19-Jun-02 3:36 
GeneralRe: get to the top of a file Pin
Steve L.19-Jun-02 3:56
Steve L.19-Jun-02 3:56 
GeneralOpening a CRecordset derived class problem Pin
Munkijo19-Jun-02 3:22
Munkijo19-Jun-02 3:22 
I am currently working on a system that uses an Access database to store a list of url's waiting to be processed. I need to be able to add to, and amend the database, and so, I have derived a class from the CRecordset class called CURLRecordset using the classwizard.

In my application, I can succesfully open a CDatabase object in order to connect to the database, but when it comes to opening the actual recordsets associated with it:

/*
CURLRecordset* unparsed_urls;
CDatabase* db;
CString sql;
*/

unparsed_urls = new ( CUnparsed ) ( db );
sql.Format ( "SELECT * FROM urls WHERE status = %d;", STATUS_NOT_CRAWLED );
unparsed_urls->Open ( CRecordset::snapshot, (LPCTSTR)sql );


I get the following exception:
"Invalid character value for cast specification on column number 2 (urladdress)"

I have traced the source of the exception to the final move() function call in the CRecordset class's Open() method, but I have no idea how to deal with it. My database schema is as follows:

TABLE urls =
(
long urlid (PRIMARY KEY)
VARCHAR(256) urladdress
long status
long level
long keywordid
long sourceid
)


The header file for the CURLRecordset class is as follows:

class CURLRecordset : public CRecordset
{
public:
CURLRecordset(CDatabase* pDatabase = NULL);
DECLARE_DYNAMIC(CURLRecordset)

// Field/Param Data
//{{AFX_FIELD(CURLRecordset, CRecordset)
long m_keywordid;
long m_level;
long m_sourceid;
long m_status;
CString m_urladdress;
long m_urlid;
//}}AFX_FIELD


// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CURLRecordset)
public:
virtual CString GetDefaultConnect(); // Default connection string
virtual CString GetDefaultSQL(); // Default SQL for Recordset
virtual void DoFieldExchange(CFieldExchange* pFX); // RFX support
//}}AFX_VIRTUAL

// Implementation
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
};


Any help will be greatly appreciated!
GeneralRe: Opening a CRecordset derived class problem Pin
Chad Koehler19-Jun-02 7:18
Chad Koehler19-Jun-02 7:18 
GeneralBlowfish Encryption Pin
Senkwe Chanda19-Jun-02 3:06
Senkwe Chanda19-Jun-02 3:06 
GeneralRe: Blowfish Encryption Pin
Chris Losinger19-Jun-02 3:18
professionalChris Losinger19-Jun-02 3:18 
GeneralRe: Blowfish Encryption Pin
Senkwe Chanda19-Jun-02 3:23
Senkwe Chanda19-Jun-02 3:23 
GeneralRe: Blowfish Encryption Pin
Chris Losinger19-Jun-02 3:33
professionalChris Losinger19-Jun-02 3:33 
GeneralRe: Blowfish Encryption Pin
Senkwe Chanda19-Jun-02 3:35
Senkwe Chanda19-Jun-02 3:35 
QuestionInternet Explorer catches my Edit Control's BackSpace, arrow keys? Pin
S.Maharajan19-Jun-02 2:58
S.Maharajan19-Jun-02 2:58 
GeneralATL Service Pin
Hans Ruck19-Jun-02 2:32
Hans Ruck19-Jun-02 2:32 
GeneralRe: ATL Service Pin
19-Jun-02 2:42
suss19-Jun-02 2:42 
GeneralRe: ATL Service Pin
Hans Ruck19-Jun-02 3:18
Hans Ruck19-Jun-02 3:18 
GeneralRe: ATL Service Pin
Michael P Butler19-Jun-02 3:30
Michael P Butler19-Jun-02 3:30 
GeneralTransform and Lighting Capability on Graphics Card Pin
19-Jun-02 2:20
suss19-Jun-02 2:20 
GeneralRe: Transform and Lighting Capability on Graphics Card Pin
Alan Chambers19-Jun-02 9:50
Alan Chambers19-Jun-02 9:50 
QuestionMirrorBlt? Pin
Dov Sherman19-Jun-02 2:16
Dov Sherman19-Jun-02 2:16 
AnswerRe: MirrorBlt? Pin
Chris Losinger19-Jun-02 2:28
professionalChris Losinger19-Jun-02 2:28 
AnswerRe: MirrorBlt? Pin
Christian Graus19-Jun-02 2:53
protectorChristian Graus19-Jun-02 2:53 
GeneralRe: MirrorBlt? Pin
Chris Losinger19-Jun-02 3:44
professionalChris Losinger19-Jun-02 3:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.