GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 05-Dec-2007, 22:58
gids gids is offline
New Member
 
Join Date: Sep 2007
Posts: 4
gids is on a distinguished road

problems on linking on CDatabase and CRecordset


im studying about Database with C++ support, i create a workspace for mfc dialog box, name of workspace is ABC. the source files of C++ is on C:\VCDb. I create on ODBC the System DSN name ab, the driver of this is Microsoft Access Driver. On abc workspace i #include <afxdb.h> on StdAfx.h file, i create a button on abcDlg, i put this following codes:

CPP / C++ / C Code:

void CAbcDlg::OnButton1() 
{
	// TODO: Add your control notification handler code here
	
	CDatabase A;

	A.Open( _T("ODBC;DSN=Ab"), FALSE, FALSE);
	
	MessageBox(A.GetDatabaseName()); 

	MessageBox(A.GetConnect()); 

	CRecordset B(&A);
		
	short nIn = 0;
	
	CString szSt;

	B.GetFieldValue( nIn, szSt); // got eeror here
	
	MessageBox(szSt);
	
	
}




When i press button1 MessageBox displays C:\VCDb\Dbfile, the second messagebox displays

ODBC;DSN=Ab;DBQ=C:\VCDb\DbFile.mdb;driverId=281;FI L=MSAccess;MaxBufferSize=2048;PageTimeout=5;

and an error dialog box displays debug assertion failed program: C:\VCDB\abc\Debug\abc.exe file:

dbcore.cpp line: 1901.

please help me

thanks
 
 

Recent GIDBlogVista ?Widgets? on Windows XP by LocalTech

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CRecordset is read-only when set to snapshot??? danny77uk MS Visual C++ / MFC Forum 3 26-Jul-2007 08:13

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 19:48.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.