|
-
August 12th, 2005, 03:48 PM
#1
Database Error
Hi Gurus,
I am trying to create a data-entry form for a database. All is going out well and program builds without any error. But When I press "Save" button, It is giving me "Invalid Character Value for cast specification on column number 3 (Question)". I am unable to get cause of this error.
I have a Edit Box whose contents are added to Questions table of the database. I have created CQuestionsRecordset class for it. On dialog box, I have code something like :
void CDatabaseInterfaceDlg::OnOK()
{
// TODO: Add extra validation here
UpdateData(TRUE);
CString question = m_EditQuestion;
question.TrimLeft();
question.TrimRight();
m_DBconnection.Connect();
m_DBconnection.StoreQuestion(question);
m_DBconnection.Disconnect();
MessageBox("Test");
CDialog::OnOK();
}
The StoreQuestion function is:
void CDatabaseConnection::StoreQuestion(CString Question)
{
CQuestionsRecordset recset( &m_Database );
CString sqlString;
sqlString.Format(_T("SELECT * FROM Questions"));
// Execute the query
recset.Open(CRecordset::snapshot,sqlString,CRecordset::none);
recset.AddNew();
recset.m_Question = Question;
recset.Update();
recset.Close();
}
Please help me gurus with this problem.
Thanks in advance.
Regards,
-- Prateek J Duble
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|