Error in recordset retrieval
-
Hello, I have a query regarding recordset retrieval. This is what I have so far. 1.An SDI application(name:Database) without database support and CDatabaseView derived from CFormView 2.A second dialog(name:Dialog1) and its class Cdialog1. 3.A new MFC class CMySet derived fron Crecordset. 4.CDialog1 has a foreign variable m_pSet of type CMySet The DB connection opens properly using CDatabse.OpenEx() then i have the following code to open a recordset. "user" is one of the tables I have selected. CDialog1 dlg; dlg.m_pSet = new CMySet(m_pDB); str = "SELECT * FROM User;"; dlg.m_pSet->Open(AFX_DB_USE_DEFAULT_TYPE,str,CRecordset::none) I get an error at this point, while executing,saying "error retrieving record".Actually on clickin a button on the first main form(which just has a pic) I wanted to have a screen for username and password whiich has to be verified from the DB. Am i wrong in my approach somewhere. the application builds and compiles jus fine. Kindly help.
-
Hello, I have a query regarding recordset retrieval. This is what I have so far. 1.An SDI application(name:Database) without database support and CDatabaseView derived from CFormView 2.A second dialog(name:Dialog1) and its class Cdialog1. 3.A new MFC class CMySet derived fron Crecordset. 4.CDialog1 has a foreign variable m_pSet of type CMySet The DB connection opens properly using CDatabse.OpenEx() then i have the following code to open a recordset. "user" is one of the tables I have selected. CDialog1 dlg; dlg.m_pSet = new CMySet(m_pDB); str = "SELECT * FROM User;"; dlg.m_pSet->Open(AFX_DB_USE_DEFAULT_TYPE,str,CRecordset::none) I get an error at this point, while executing,saying "error retrieving record".Actually on clickin a button on the first main form(which just has a pic) I wanted to have a screen for username and password whiich has to be verified from the DB. Am i wrong in my approach somewhere. the application builds and compiles jus fine. Kindly help.
namratab wrote:
I get an error at this point, while executing,saying "error retrieving record".
So why don't you step into the
Open()
call to see what's going on?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
namratab wrote:
I get an error at this point, while executing,saying "error retrieving record".
So why don't you step into the
Open()
call to see what's going on?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
-
ACtually, the exact same Open call worked in another small aplication. The only difference was that the object invoking the Open() method was of type REcordSEt...and in my case it is of a type MySEt ( derived from recordSEt)
But until you actually step into the
Open()
call, you'll not know the cause of the error. I've only done one article dealing with record sets. See if this is of any help.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb