Click here to Skip to main content
16,006,355 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Adding a new popup menu Pin
Christian Graus22-May-01 1:47
protectorChristian Graus22-May-01 1:47 
GeneralRe: Adding a new popup menu Pin
Bartek22-May-01 2:22
Bartek22-May-01 2:22 
Generalactivex Pin
eXplodus21-May-01 23:56
eXplodus21-May-01 23:56 
GeneralEnterbutton Pin
21-May-01 23:31
suss21-May-01 23:31 
GeneralRe: Enterbutton Pin
22-May-01 5:41
suss22-May-01 5:41 
GeneralRe: Enterbutton Pin
22-May-01 20:51
suss22-May-01 20:51 
GeneralADO Parameters Pin
Richard Hudson21-May-01 22:46
Richard Hudson21-May-01 22:46 
GeneralRe: ADO Parameters Pin
John M. Drescher22-May-01 9:31
John M. Drescher22-May-01 9:31 
try {
_CommandPtr cmd;
_ParameterPtr prmStudyNumber;
_ParameterPtr prmCadSysNumber;
_RecordsetPtr pRstCase = NULL;

TESTHR(cmd.CreateInstance(__uuidof(Command))); // Test a hresult

CString tempStr;

tempStr.Format("SELECT * FROM %s ;","CountPerCaseStatsCueType");
// CountPerCaseStatsCueType is a view "Query" in an access 2000 db that has 2 parameters

cmd->ActiveConnection = GetConnection(); // My function that returns a _ConnectionPtr that is open from a previous call
cmd->CommandText = _bstr_t(tempStr);

prmStudyNumber = cmd->CreateParameter(_bstr_t("StudyParam"),adInteger,adParamInput,-1,_variant_t((long)nStudy));
cmd->Parameters->Append(prmStudyNumber);

prmCadSysNumber = cmd->CreateParameter(_bstr_t("CadSysParam"),adInteger,adParamInput,-1,_variant_t((long)nCadSys));
cmd->Parameters->Append(prmCadSysNumber);

// NOTE: The Database will ignore the parameter names so you must place the parameters in the same order as you
// have defined in your view "query".

CStringEx str;
_variant_t var;
_variant_t v1(DISP_E_PARAMNOTFOUND,VT_ERROR);
_variant_t v2(DISP_E_PARAMNOTFOUND,VT_ERROR);
pRstCase = cmd->Execute(&v1,&v2,adCmdText);
while(!pRstCase->adoEOF) {
// Do something with the data
pRstCase->MoveNext();
}
}
catch (_com_error &e)
{
GenerateError(e.Error(), e.Description()); // My error message handler
}
catch( CException* e)
{
GenerateError(e);
}
catch (...)
{
m_pDoc->GetLog()->LogTime();
m_pDoc->GetLog()->Log("\nDATABASE ERROR: Unknown Exception in CCaseDataBase::GetCaseCoverageTypeStatisticsAll()");
}


I took this code out of one of my recent projects, I hope this helps.

John

GeneralRe: ADO Parameters Pin
Carlos Antollini22-May-01 9:40
Carlos Antollini22-May-01 9:40 
GeneralDateTime Class Pin
Gerry21-May-01 22:24
Gerry21-May-01 22:24 
GeneralHELP !!! fit size of dialod window to various resolutions Pin
21-May-01 21:48
suss21-May-01 21:48 
GeneralRe: HELP !!! fit size of dialod window to various resolutions Pin
Christian Graus21-May-01 23:27
protectorChristian Graus21-May-01 23:27 
GeneralRe: HELP !!! fit size of dialod window to various resolutions Pin
22-May-01 0:01
suss22-May-01 0:01 
GeneralRe: HELP !!! fit size of dialod window to various resolutions Pin
Christian Graus22-May-01 0:09
protectorChristian Graus22-May-01 0:09 
GeneralRe: HELP !!! fit size of dialod window to various resolutions Pin
22-May-01 3:05
suss22-May-01 3:05 
GeneralRe: HELP !!! fit size of dialod window to various resolutions Pin
Christian Graus22-May-01 3:29
protectorChristian Graus22-May-01 3:29 
QuestionHow can I read data from EXEL file? Pin
21-May-01 21:00
suss21-May-01 21:00 
AnswerRe: How can I read data from EXEL file? Pin
Michael Martin21-May-01 22:30
professionalMichael Martin21-May-01 22:30 
Generalmedia control interface Pin
dearsrinu21-May-01 19:45
dearsrinu21-May-01 19:45 
GeneralOpenGL drawing Pin
v_krishnan21-May-01 19:14
v_krishnan21-May-01 19:14 
GeneralRe: OpenGL drawing Pin
Michael S. Scherotter21-May-01 19:51
Michael S. Scherotter21-May-01 19:51 
QuestionHow to trap CTRL+ALT+(key) in an MFC dlg-based app? Pin
Savage21-May-01 18:40
Savage21-May-01 18:40 
AnswerRe: How to trap CTRL+ALT+(key) in an MFC dlg-based app? Pin
Savage21-May-01 20:31
Savage21-May-01 20:31 
GeneralDirectshow Pin
21-May-01 17:40
suss21-May-01 17:40 
Questionany solution to 2038 bug? Pin
21-May-01 16:58
suss21-May-01 16:58 

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.