Click here to Skip to main content
15,902,635 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: COM class registration failed. Pin
Rajkumar R8-Feb-08 2:01
Rajkumar R8-Feb-08 2:01 
Generaleditbox display problem Pin
Chandrasekharan P7-Feb-08 19:24
Chandrasekharan P7-Feb-08 19:24 
QuestionRe: editbox display problem Pin
Rajesh R Subramanian7-Feb-08 20:14
professionalRajesh R Subramanian7-Feb-08 20:14 
GeneralRe: editbox display problem Pin
Chandrasekharan P7-Feb-08 20:59
Chandrasekharan P7-Feb-08 20:59 
GeneralRe: editbox display problem Pin
Chandrasekharan P7-Feb-08 21:11
Chandrasekharan P7-Feb-08 21:11 
GeneralRe: editbox display problem Pin
Hamid_RT10-Feb-08 21:35
Hamid_RT10-Feb-08 21:35 
QuestionCreating SQL Database .mdf file using MFC , VC++ ? Pin
nitin_pro7-Feb-08 19:09
nitin_pro7-Feb-08 19:09 
AnswerRe: Creating SQL Database .mdf file using MFC , VC++ ? Pin
BadKarma8-Feb-08 0:04
BadKarma8-Feb-08 0:04 
Hi,

its possible by using ado. In order to do let it work, you must preform some setup tasks.
1. Import the Library
place the following line in the stdafx.h file. the msado15.dll file should be located in the project directory.
#import "msado15.dll" no_namespace rename ("EOF", "adoEOF")

2. Initialize the ole lib
Ado works with oledb.
if(OleInitialize(NULL) != S_OK)
{
  // Error, stop
}

3. Connect to the database
Replace USER_ID, PASSWORD, SQLSERVERNAME, DATABASE_NAME with the correct values
CString strConnectionString;
strConnectionString.Format("uid=USER_ID;pwd=PASSWORD;driver={SQL Server};server=SQLSERVERNAME;database=DATABASE_NAME");

_ConnectionPtr ptrDbCon;
ptrDbCon.CreateInstance(__uuidof(Connection));
ptrDbCon->Open((_bstr_t)strConnectionString, "", "", -1);
<code></code>


You sould connect to the master database in order to create another database.
Just execute the queries to create an database as you need.

codito ergo sum

GeneralRe: Creating SQL Database .mdf file using MFC , VC++ ? Pin
nitin_pro8-Feb-08 0:21
nitin_pro8-Feb-08 0:21 
AnswerRe: Creating SQL Database .mdf file using MFC , VC++ ? Pin
David Crow8-Feb-08 2:56
David Crow8-Feb-08 2:56 
GeneralRe: Creating SQL Database .mdf file using MFC , VC++ ? Pin
aaaan10-Feb-08 22:27
aaaan10-Feb-08 22:27 
GeneralRe: Creating SQL Database .mdf file using MFC , VC++ ? Pin
David Crow11-Feb-08 2:45
David Crow11-Feb-08 2:45 
AnswerRe: Creating SQL Database .mdf file using MFC , VC++ ? Pin
Hamid_RT10-Feb-08 21:35
Hamid_RT10-Feb-08 21:35 
GeneralPLZ suggest me!!!!!!!!! Pin
rowdy_vc++7-Feb-08 18:56
rowdy_vc++7-Feb-08 18:56 
GeneralRe: PLZ suggest me!!!!!!!!! Pin
Rajesh R Subramanian7-Feb-08 19:11
professionalRajesh R Subramanian7-Feb-08 19:11 
GeneralRe: PLZ suggest me!!!!!!!!! Pin
Chandrasekharan P7-Feb-08 19:41
Chandrasekharan P7-Feb-08 19:41 
GeneralRe: PLZ suggest me!!!!!!!!! Pin
Rajesh R Subramanian7-Feb-08 20:03
professionalRajesh R Subramanian7-Feb-08 20:03 
GeneralRe: PLZ suggest me!!!!!!!!! Pin
Chandrasekharan P7-Feb-08 20:58
Chandrasekharan P7-Feb-08 20:58 
GeneralRe: PLZ suggest me!!!!!!!!! Pin
Rajesh R Subramanian7-Feb-08 21:37
professionalRajesh R Subramanian7-Feb-08 21:37 
GeneralRe: PLZ suggest me!!!!!!!!! Pin
Chandrasekharan P7-Feb-08 22:13
Chandrasekharan P7-Feb-08 22:13 
GeneralRe: PLZ suggest me!!!!!!!!! Pin
Hamid_RT10-Feb-08 21:38
Hamid_RT10-Feb-08 21:38 
GeneralRe: PLZ suggest me!!!!!!!!! Pin
ShilpiP7-Feb-08 22:41
ShilpiP7-Feb-08 22:41 
GeneralRe: PLZ suggest me!!!!!!!!! Pin
Rajesh R Subramanian7-Feb-08 23:22
professionalRajesh R Subramanian7-Feb-08 23:22 
GeneralRe: PLZ suggest me!!!!!!!!! Pin
ShilpiP7-Feb-08 23:53
ShilpiP7-Feb-08 23:53 
GeneralRe: PLZ suggest me!!!!!!!!! Pin
David Crow8-Feb-08 3:01
David Crow8-Feb-08 3:01 

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.