Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
I want access sql server 2005 database in mfc(how)?
Posted

It will be beneficial if you check these two classes
- CDatabase[^]
- CRecordSet[^]

Good luck,
OI
 
Share this answer
 
Comments
Member 10068675 23-May-13 2:18am    
Is any database library usable?
First create dsn for database.
C++
#include "afxdb.h"
CDatabase m_database;
CRecordset m_recordset;
bool p=m_database.Open(_T(DSN name),0,0,_T("ODBC;"),1);
m_recordset.m_pDatabase = &m_database; //tell CRecordset where to find the database	
m_recordset.Open(AFX_DB_USE_DEFAULT_TYPE,_T("select * from Table1"),CRecordset::appendOnly);
//Get the number of the selected records
long reCount=m_recordset.GetRecordCount();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900