Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Embedding SQL into VC++

Status
Not open for further replies.

stefee

Programmer
Aug 25, 2000
12
0
0
US
How do you embed SQL into Visual C++? I’ve found some resources on embedding SQL into C, but that isn’t helping me. I have to build a query in my program that searches several tables for matching data then displays it. I am currently using several nested loops, this works however, it slows the computer down especially when you are on the server (network). I figured that building queries in SQL would be the best way to go about this. Now I just need to find out how. I saw information on ADO as well, but I kind of want to see if there is a way to use something like the SQLExecute(). I can't Seem to figure out how to use that though. Please help.

Thanks in advance,
Stefee
 
This bit a code might help...

CDatabase db;
CString strSQL;

// Open the database with its DSN Name.
db.OpenEx( _T( "DSN=HWULogData" ),
CDatabase::noOdbcDialog );

//Build the SQLQuery
strSQL = _T("DELETE FROM [MissionData] WHERE(([MissionData].[MissionName])='");
strSQL += logfileName;
strSQL += _T("');");

TRY
{
db.ExecuteSQL( strSQL);
}
CATCH(CDBException, e)
{
// The error code is in e->m_nRetCode
return (e->m_nRetCode);
}
END_CATCH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top