I am reworking old VB6 apps into VB.NET with Visual Studio 2005 and all of them suffer from the same problems.
One of those is, access the DB2 database by using an Access 2000 file which has links to the tables and second approach is, using ADODB.RecordSet with concatenated string SQL queries directly run on to the database.
I know I can use Linq which is the right tool for the job, but I don't have time to learn it at the moment. I have to finish this job quickly.
Examples:
Function selectNA_FromMyTable_ByNA(ByVal na As String) As String
Dim sql As String = "SELECT na FROM DB2Scheme.MyTable "
sql = sql & "WHERE (na = '" & na & "')"
Return sql
End Function
and
Function selectNA_FromMyTable_ByNA(ByVal na As String) As String
Dim sql As String = "SELECT na FROM DB2Scheme_MyTable "
sql = sql & "WHERE (na = '" & na & "')"
Return sql
End Function
where DB2Scheme_MyTable is link to DB2Scheme.MyTable table.
I don't like mixing approaches although they both work properly.
Which is better approach?
Which approach would be better for debugging? For example, how can I detect that the user using the application does not have privileges to write or read data from a certain table in the scheme?