Click here to Skip to main content
15,897,718 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Call back function Pin
naveenkm841-Feb-07 1:35
naveenkm841-Feb-07 1:35 
AnswerRe: Call back function Pin
Hamid_RT1-Feb-07 1:35
Hamid_RT1-Feb-07 1:35 
GeneralRe: Call back function Pin
see me1-Feb-07 2:23
see me1-Feb-07 2:23 
GeneralRe: Call back function Pin
David Crow1-Feb-07 2:59
David Crow1-Feb-07 2:59 
GeneralRe: Call back function Pin
Mark Salsbery1-Feb-07 7:59
Mark Salsbery1-Feb-07 7:59 
QuestionSlow in retrieving the records. Pin
Taruni1-Feb-07 0:43
Taruni1-Feb-07 0:43 
QuestionRe: Slow in retrieving the records. Pin
David Crow1-Feb-07 3:02
David Crow1-Feb-07 3:02 
AnswerRe: Slow in retrieving the records. Pin
Taruni1-Feb-07 17:30
Taruni1-Feb-07 17:30 
The database is in the same computer where my program resides.Actually I am fetching the records from the database and placing them on a grid control.

The code for fetching the records is as follows:

_ConnectionPtr pConn;
_RecordsetPtr pRecSet;
TCHAR strQuery[5000];

HRESULT hr;
CString strConn;
hr=pConn.CreateInstance(__uuidof(Connection));

if (SUCCEEDED(hr))
{

}
else
{
AfxMessageBox(_T("Failed to establish connection"));
return;
}

strConn.Format(_T("Provider=Microsoft.Jet.OleDB.4.0;Data source=%s;"),strPath);

hr=pRecSet.CreateInstance(__uuidof(Recordset));

if (SUCCEEDED(hr))
{

}
else
{
AfxMessageBox(_T("Recordset creation failed"));
return;
}
BSTR bstrconn = strConn.AllocSysString();
BSTR bstrNull = NULL;

hr = pConn->Open(bstrconn,bstrNull,bstrNull,adModeUnknown);
if(FAILED(hr))
{
AfxMessageBox(_T("Failed to open database connection"));
return;
}

try
{
VARIANT v;
VariantInit(&v);
v.vt=VT_BSTR;
_stprintf(strQuery,_T("Select * from MyDatabase"));
CString str;
CString strColName;

while(!(VARIANT_TRUE == pRecSet->EndOfFile))
{
for(int i=0;i<columnnames.getsize();i++)
{
=""
="" strcolname="ColumnNames.GetAt(i);
" v.bstrval="strColName.AllocSysString();
" fieldsptr="" fp;
="" fp="pRecSet-">Fields;
_variant_t var;
VariantInit(&var);
var= fp->GetItem(v)->GetValue();
str = var.bstrVal;
AfxMessageBox(str);
}
pRecSet->MoveNext();
}
pRecSet->Close();
pConn->Close();
}
catch()
{
.......

}


Taruni

QuestionRe: Slow in retrieving the records. Pin
David Crow2-Feb-07 2:35
David Crow2-Feb-07 2:35 
QuestionSAX2 PARSER Pin
amitmistry_petlad 1-Feb-07 0:34
amitmistry_petlad 1-Feb-07 0:34 
AnswerRe: SAX2 PARSER Pin
Hamid_RT1-Feb-07 0:46
Hamid_RT1-Feb-07 0:46 
GeneralRe: SAX2 PARSER Pin
amitmistry_petlad 1-Feb-07 1:12
amitmistry_petlad 1-Feb-07 1:12 
GeneralRe: SAX2 PARSER Pin
Hamid_RT1-Feb-07 1:33
Hamid_RT1-Feb-07 1:33 
Questionhow to kill a process Pin
dvsr1-Feb-07 0:30
dvsr1-Feb-07 0:30 
AnswerRe: how to kill a process Pin
goodoljosh19801-Feb-07 0:52
goodoljosh19801-Feb-07 0:52 
AnswerRe: how to kill a process Pin
Hamid_RT1-Feb-07 0:55
Hamid_RT1-Feb-07 0:55 
AnswerRe: how to kill a process Pin
Stephen Hewitt1-Feb-07 12:08
Stephen Hewitt1-Feb-07 12:08 
QuestionProblem with Resource translation Pin
AbbyIndian1-Feb-07 0:20
AbbyIndian1-Feb-07 0:20 
AnswerRe: Problem with Resource translation Pin
Waldermort1-Feb-07 2:00
Waldermort1-Feb-07 2:00 
QuestionRe: Problem with Resource translation [modified] Pin
AbbyIndian1-Feb-07 7:41
AbbyIndian1-Feb-07 7:41 
AnswerRe: Problem with Resource translation Pin
Waldermort1-Feb-07 18:10
Waldermort1-Feb-07 18:10 
GeneralRe: Problem with Resource translation Pin
AbbyIndian1-Feb-07 18:43
AbbyIndian1-Feb-07 18:43 
QuestionVideo Preview from Video Packets in VC6? Pin
Andy Rama31-Jan-07 23:41
Andy Rama31-Jan-07 23:41 
AnswerRe: Video Preview from Video Packets in VC6? Pin
Mark Salsbery1-Feb-07 8:10
Mark Salsbery1-Feb-07 8:10 
AnswerRe: Video Preview from Video Packets in VC6? Pin
Hamid_RT1-Feb-07 20:36
Hamid_RT1-Feb-07 20:36 

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.