MySQL Forums
Forum List  »  Performance

Reduce the Query Execution Time Between MYSQL & VC++
Posted by: saraswathi srinath
Date: November 12, 2014 05:01AM

Hi,

I'm using Mysql Server 5.6, ODBC 5.2 & Visual Studio 2012.

I was write a small program Using VC++ & MYSQL, Which is a mysql read operation.
Code working Good. But, The Query Execution Time is 5 seconds. How can i reduce this. pls help me.

Sample Code As folllows,

void MainScreen::OnreadProfileName()
{
// TODO: Add your control notification handler code here
CDatabase database;
CString SqlString;
CString sDsn;
int iRec = 0;
CString pname;

sDsn.Format("Driver={MySQL ODBC 5.2 ANSI Driver};Server=localhost;Database=test;User=root;Password=client;Option=4;");
TRY
{
// Open the database
database.Open(NULL,false,false,sDsn);
CRecordset recset( &database );
SqlString = "SELECT PNAME FROM PROFILEMASTER";
recset.Open(CRecordset::forwardOnly,SqlString,CRecordset::readOnly);

while( !recset.IsEOF() )
{
recset.GetFieldValue("PNAME",pname);
m_proname.InsertString(0,pname); //ComboBox
recset.MoveNext();
}
database.Close();
}
CATCH(CDBException, e)
{
// If a database exception occured, show error msg
AfxMessageBox("Database error: "+e->m_strError);
}
END_CATCH;
}

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.