DPomeroy
asked on
database connection
I am trying to access create a Paradox database with an
SQL statement. I don't want to use any of the database components. Can I code all of the connection properties and then use the SQL create command? After I create then I need to access the database with SQL commands. I can't seem to find anything on this process in any of the supplied Delphi books or in any of the books at my local book store. Thanks for your help.
SQL statement. I don't want to use any of the database components. Can I code all of the connection properties and then use the SQL create command? After I create then I need to access the database with SQL commands. I can't seem to find anything on this process in any of the supplied Delphi books or in any of the books at my local book store. Thanks for your help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I sure can't find that BDE help file in my system. I have Delphi 2.0. I will keep trying. It seems to me that there should be something written in some book somewhere that would show me how to do this. It took about 3 minutes for me to figure it out in Visual Basic. There documentation is so much better than Borlands. Its a shame.
Create a table on disk by using a given SQL statement.
The filename is also passed as a parameter. The function returns the number of rows in the result table. This example uses the following input:
fDbiQExec(hNewCur, 'QUERY.DB', 'SELECT * FROM TEST;');
Function fDbiQExec(hTmpDb: hDBIDB; TblName, SQL: String): Longint;
var
hStmt: hDBIStmt;
hQryCur, hNewCur: hDBICur;
iRecCount: LongInt;
begin
hQryCur := nil;
hNewCur := nil;
hStmt := nil;
try
Check(DbiQAlloc(hTmpDb, qrylangSQL, hStmt));
Check(DbiQPrepare(hStmt, PChar(SQL)));
Check(DbiQExec(hStmt, @hQryCur));
Check(DbiQInstantiateAnswe
true, hNewCur));
Check(DbiGetRecordCount(hN
Result := iRecCount;
finally
if hStmt <> nil then
Check(DbiQFree(hStmt));
if hNewCur <> nil then
Check(DbiCloseCursor(hNewC
end;
end;