J
Jerome
Hoi,
Some advice about VS2005 needed
I have a major project written in VB6 where all database interactions are
nicely combined in one ClassModule witch gave
me the opportunity to work with the Connection.Execute method. The
ClassInitialise makes the connection and from then
all works like a charm. The module contains about 250 insert/update/select
subs/functions
Now, when trying to make it inVS2005, the inserts/updates subs makes no
prblem to convert because the string for that
are almost the same:
Sub InstelFaktInitNummer(ByVal pWaarde As Integer, ByVal pCode As String)
Dim strSql As String
strSql = "UPDATE Dagboek SET da_nummer = " & pWaarde & " Where da_code =
'" & pCode & "'"
connection.Execute (strSql)
End Sub
So, making a command object and executenoquery instead of the
connection.execute does the trick, no problem. Altough the connection will
remain open as was in VB6
But...what about a function wich returns a Recordset (VB6) ??
fi:
Function GetArtikelsBeheerMain() As ADODB.Recordset
Dim strSql As String
strSql = "SELECT ar_id, ar_code, ar_naam, ar_aantal, ar_inbestel, ar_pr,
" & _
"ar_pv, ar_min, ar_max, ar_discon, " & _
"ar_lever, ar_maxkort, ar_barcode, ar_datmaak, ar_usermaak,
" & _
"ar_datwijzig, ar_userwijzig FROM Artikel ORDER BY ar_code"
Set GetArtikelsBeheerMain = connection.Execute(strSql)
End Function
Then on a (MDI child) Form i just call
SET MyGrid.Datasource = DbConn.GetArtikelsBeheerMain
(info....DbConn is an instance of the ClassModule)
My question: How to do this last one in VB2005 ? How can i put ALL the
funcions in 1 module for retrieving the database
recordsets (dataset/tableset or whatever they may be called nowadays) and
call/open/close them?
Thanks in advance for all suggestions
Jerome
Some advice about VS2005 needed
I have a major project written in VB6 where all database interactions are
nicely combined in one ClassModule witch gave
me the opportunity to work with the Connection.Execute method. The
ClassInitialise makes the connection and from then
all works like a charm. The module contains about 250 insert/update/select
subs/functions
Now, when trying to make it inVS2005, the inserts/updates subs makes no
prblem to convert because the string for that
are almost the same:
Sub InstelFaktInitNummer(ByVal pWaarde As Integer, ByVal pCode As String)
Dim strSql As String
strSql = "UPDATE Dagboek SET da_nummer = " & pWaarde & " Where da_code =
'" & pCode & "'"
connection.Execute (strSql)
End Sub
So, making a command object and executenoquery instead of the
connection.execute does the trick, no problem. Altough the connection will
remain open as was in VB6
But...what about a function wich returns a Recordset (VB6) ??
fi:
Function GetArtikelsBeheerMain() As ADODB.Recordset
Dim strSql As String
strSql = "SELECT ar_id, ar_code, ar_naam, ar_aantal, ar_inbestel, ar_pr,
" & _
"ar_pv, ar_min, ar_max, ar_discon, " & _
"ar_lever, ar_maxkort, ar_barcode, ar_datmaak, ar_usermaak,
" & _
"ar_datwijzig, ar_userwijzig FROM Artikel ORDER BY ar_code"
Set GetArtikelsBeheerMain = connection.Execute(strSql)
End Function
Then on a (MDI child) Form i just call
SET MyGrid.Datasource = DbConn.GetArtikelsBeheerMain
(info....DbConn is an instance of the ClassModule)
My question: How to do this last one in VB2005 ? How can i put ALL the
funcions in 1 module for retrieving the database
recordsets (dataset/tableset or whatever they may be called nowadays) and
call/open/close them?
Thanks in advance for all suggestions
Jerome