0
我想弄明白這個代碼是如何工作的,因爲它從VB6和我將它轉換爲VB.NET,此程序的以前的開發人員告訴我,lstrvalue
是一個SQL代碼,但我沒有看到像SELECT,UPDATE等常見語句,這就是爲什麼我不理解它。用SQL將VB6轉換爲VB.NET
rs.Open "Select AccountCode,rtrim(type) as type, rtrim(left(formula,3)) as bet1,ltrim(right(formula,3))as bet2 from vwTempTableWP where rtrim(type) in('SUM','+','-') order by orderby", con
If rs.EOF Then
Else
rs.MoveFirst
Do While rs.EOF <> True
codetype = Trim(rs!AccountCode)
tipo = Trim(rs!Type)
bet1 = CDbl(Trim(rs!bet1))
bet2 = CDbl(Trim(rs!bet2))
If tipo = "SUM" Then
lstrValue = "execute sp_sum '" & Trim(codetype) & "','Working'," & CDbl(bet1) & "," & CDbl(bet2) & ""
con.Execute lstrValue
'Do While con.State = adStateExecuting
'Loop
ElseIf tipo = "+" Then
lstrValue = "execute sp_add '" & Trim(codetype) & "','" & Trim(report) & "'," & CDbl(bet1) & "," & CDbl(bet2) & ""
con.Execute lstrValue
'Do While con.State = adStateExecuting
'Loop
ElseIf tipo = "-" Then
lstrValue = "execute sp_minus '" & Trim(codetype) & "','" & Trim(report) & "'," & CDbl(bet1) & "," & CDbl(bet2) & ""
con.Execute lstrValue
'Do While con.State = adStateExecuting
'Loop
End If
rs.MoveNext
Loop
rs.Close
End If
RS被定義爲新
ADODB.Recordset
CON被定義爲新
ADODB.Connection