Click here to Skip to main content
16,007,126 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Change Cursor Pin
Michael Dunn30-Oct-01 22:32
sitebuilderMichael Dunn30-Oct-01 22:32 
GeneralRe: Change Cursor Pin
Maer72731-Oct-01 1:03
Maer72731-Oct-01 1:03 
QuestionWhat do the MIME email looks like? Pin
cococut30-Oct-01 20:19
cococut30-Oct-01 20:19 
AnswerRe: What do the MIME email looks like? Pin
markkuk30-Oct-01 20:35
markkuk30-Oct-01 20:35 
GeneralBreakpoints in DLL Pin
Nevidimka30-Oct-01 18:35
Nevidimka30-Oct-01 18:35 
GeneralRe: Breakpoints in DLL Pin
Bernhard30-Oct-01 22:15
Bernhard30-Oct-01 22:15 
GeneralRe: Breakpoints in DLL Pin
Bernhard30-Oct-01 22:18
Bernhard30-Oct-01 22:18 
GeneralAccess Database woes... Pin
Tryhard30-Oct-01 18:22
Tryhard30-Oct-01 18:22 
Hi all,

I am trying to update a record in an Access Database(I am new to DB programming and VC++), from everything I have read the following code should acheive the desired result but it gives a DB exception.

Have I missed a readonly flag or got something wrong in my database.open command???

Any pointers greatly appreciated,
Thanks in advance,
Tryhard

Code:-

CDatabase database;
CString sSql;
CString sDriver = "MICROSOFT ACCESS DRIVER (*.mdb)";
CString sDsn;
CString sFile = "d:\\Docs\\Wayne\\C\\Converse\\CDAT.mdb";


TRY
{
// Build the creation string for access without DSN

sSql.Format("ODBC;DRIVER={%s};DSN='';DBQ=%s",sDriver,sFile);


// Open the database
database.Open(NULL,false,false,sDsn);

// Allocate the recordset
CRecordset recset( &database );

// Update data
sSql = "UPDATE Convhist "
"SET GREETINGCOUNT = '1'"
"WHERE YOURFIRSTNAME = 'WAYNE'";

// Execute SQL Statement
database.ExecuteSQL(sSql);


// Close the database

database.Close();

}
CATCH(CDBException, e)
{
// If a database exception occured, show error msg
AfxMessageBox("Database error: "+e->m_strError);
}
END_CATCH;
}Confused | :confused: Confused | :confused:

Tryhard Smile | :)
GeneralRe: Access Database woes... Pin
solex30-Oct-01 23:32
solex30-Oct-01 23:32 
GeneralVC++ Standard and Unicode Pin
Matt Newman30-Oct-01 16:40
Matt Newman30-Oct-01 16:40 
GeneralRe: VC++ Standard and Unicode Pin
Michael Dunn30-Oct-01 17:07
sitebuilderMichael Dunn30-Oct-01 17:07 
GeneralRe: VC++ Standard and Unicode Pin
Matt Newman31-Oct-01 11:23
Matt Newman31-Oct-01 11:23 
GeneralRe: VC++ Standard and Unicode Pin
Michael Dunn31-Oct-01 17:06
sitebuilderMichael Dunn31-Oct-01 17:06 
GeneralRe: VC++ Standard and Unicode Pin
Matt Newman1-Nov-01 13:30
Matt Newman1-Nov-01 13:30 
QuestionHow to get the bits from a DIB? Pin
clintsinger30-Oct-01 14:22
clintsinger30-Oct-01 14:22 
AnswerRe: How to get the bits from a DIB? Pin
Christian Graus30-Oct-01 14:37
protectorChristian Graus30-Oct-01 14:37 
GeneralRe: How to get the bits from a DIB? Pin
clintsinger31-Oct-01 6:03
clintsinger31-Oct-01 6:03 
GeneralRe: How to get the bits from a DIB? Pin
Chris Losinger31-Oct-01 6:22
professionalChris Losinger31-Oct-01 6:22 
GeneralBetter than the Startup folder Pin
Jason Hooper30-Oct-01 14:12
Jason Hooper30-Oct-01 14:12 
GeneralRe: Better than the Startup folder Pin
Christian Graus30-Oct-01 15:03
protectorChristian Graus30-Oct-01 15:03 
GeneralRe: Better than the Startup folder Pin
Michael Martin30-Oct-01 15:42
professionalMichael Martin30-Oct-01 15:42 
GeneralRe: Better than the Startup folder Pin
Nish Nishant30-Oct-01 16:18
sitebuilderNish Nishant30-Oct-01 16:18 
GeneralRe: Better than the Startup folder Pin
Jason Hooper30-Oct-01 23:32
Jason Hooper30-Oct-01 23:32 
GeneralRe: Better than the Startup folder Pin
solex30-Oct-01 23:37
solex30-Oct-01 23:37 
GeneralRe: Better than the Startup folder Pin
Rick Crone31-Oct-01 9:21
Rick Crone31-Oct-01 9:21 

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.