
VB 4.0 Database Access via ODBC
In testing why an application was running so slow through a dial-up
Point-To-Point networking configuration, I analyzed what our Visual Basic
and Power Builder apps were doing in their start up routines.
I turned on the ODBC tracing (through odbcad32.exe Options) and was
surprised that the Power Builder apps call the ODBC considerably
differently than our apps written in VB.
Since Power Builder can use embedded SQL and supports bound variables in
its SQL, it will submit a Query, bind the return columns and will be able
to access the data after each fetch.
Our VB code on the other hand submits the query, does as many DescribeCol
calls as the number of columns in the result set and then does a GetData
call for each column after every single fetch. Since one of the tables,
has 68 columns and there were hundreds of thousands of rows, you can
imagine the inefficiency of the extra ODBC calls going on behind the
scenes.
MY QUESTION IS, IS THERE ANY BETTER WAY TO ACCESS DATA IF YOU ARE GOING TO
RETURN THOUSANDS OF ROWS FROM THE SAME TABLE.
COMMENTS WOULD BE GREATLY APPRECIATED.
P.S. I do not know if this is addressed in VB 5.0 with direct support for
bound variables.