我有一个包含以下字段的 sqlite 表:
Langauge level hours
German 2 50
French 3 40
English 1 60
German 1 10
English 2 50
English 3 60
German 1 20
French 2 40
我想根据语言和其他条件遍历记录,然后将当前选择的记录传递给不同的函数。所以我有以下实际代码和伪代码的混合。请帮助我将伪代码转换为实际代码。我发现这样做很难。
这是我所拥有的:
Private sub mainp()
Dim oslcConnection As New SQLite.SQLiteConnection
Dim oslcCommand As SQLite.SQLiteCommand
Dim langs() As String = {"German", "French", "English"}
Dim i as Integer = 0
oslcConnection.ConnectionString = "Data Source=" & My.Settings.dbFullPath & ";"
oslcConnection.Open()
oslcCommand = oslcConnection.CreateCommand
Do While i <= langs.count
If langs(i) = "German" Then
oslcCommand.CommandText = "SELECT * FROM table WHERE language = '" & langs(i) & "';"
For each record selected 'psudo code
If level = 1 Then 'psudo code
update level to 2 'psudo code
minorp(currentRecord) 'psudo code: calling minorp function and passing the whole record as a parameter
End If 'psudo code
If level = 2 Then 'psudo code
update level to 3 'psudo code
minorp(currentRecord) 'psudo code: calling minorp function and passing the whole record as a parameter
End If 'psudo code
Next 'psudo code
End If
If langs(i) = "French" Then
oslcCommand.CommandText = "SELECT * FROM table WHERE language = '" & langs(i) & "';"
For each record selected 'psudo code
If level = 1 Then 'psudo code
update level to 2 'psudo code
minorp(currentRecord) 'psudo code: calling minorp function and passing the whole record as a parameter
End If 'psudo code
If level = 2 Then 'psudo code
update level to 3 'psudo code
minorp(currentRecord) 'psudo code: calling minorp function and passing the whole record as a parameter
End If 'psudo code
Next 'psudo code
End If
Loop
End Sub
非常感谢您的帮助。