Shahzad
May 24th, 1999, 01:36 PM
I have worked with databases with m_strFilter variable and it works nice, but now I need to open a database table, with a complete SQL query. I suppose I have to do this by passing the sql string in Open() function. Can somebody give a little code for this!
If you're using SQL, the DBMS makes a difference. I'll assume you're using Oracle, and give you code for that. First you connect to the database with:
EXEC SQL CONNECT :hv_szUserId
IDENTIFIED BY :hv_szPasswd
USING :hv_szHostId;
Once you've got a connection to the database, perform whatever function you'd like. For example, to query the databse, you can select a first name where the last name is smith from the Names table.
SELECT firstName
FROM Names
WHERE lastName = 'Smith';
Is that what you were looking for?