General information
Category:
Coding, syntax & commands
Dear All,
I stuck in making this code in Visual Fox Pro , So I wrote it in VB 6.0. How I can Convert it into Visual FoxPro?
Please find out the code...
the form i designed is composed of four controls
Txt_Initial as text box
Cmb_Sem as Combo Box
Cmb_Mid as Combo Box
Cmd_Ok as Command Button
Regards,
Dim Cn As New rdoConnection
Dim Qd As rdoQuery
Private Sub Cmd_Ok_Click()
Screen.MousePointer = vbHourglass
Call Fill_Grid
Screen.MousePointer = vbNormal
End Sub
Private Sub Form_Load()
Cn.CursorDriver = rdUseOdbc
Cn.Connect = "dsn=ounis"
Cn.EstablishConnection
End Sub
Private Sub Fill_Grid()
Dim Rs As rdoResultset
Dim RsTemp As rdoResultset
Dim Str As String
Dim Arr(4) As String
Dim Temp1 As String
Dim Temp2 As String
Arr(0) = "H1"
Arr(1) = "H2"
Arr(2) = "H3"
Arr(3) = "H4"
Cn.Execute ("Delete from Temp")
For i = 0 To 3
Str = "Select Name , LastName , StudentCod From Ounis " _
& " Where Initial" & Arr(i) & " = '" & Txt_Initial.Text & "'"
Set Rs = OpenQuery(Str)
While Not Rs.EOF
Str = "Select * from Temp Where 1 <> 1 "
Set RsTemp = OpenQuery(Str)
With RsTemp
.AddNew
!StudentNo = Rs!StudentCod
!Name = Rs!Name
!LastName = Rs!LastName
!Mark = 0
Select Case Cmb_Sem.ListIndex
Case 0:
Select Case Cmb_Mid.ListIndex
Case 0:
Temp2 = "1"
Case 1:
Temp2 = "2"
End Select
Case 1:
Select Case Cmb_Mid.ListIndex
Case 0:
Temp2 = "3"
Case 1:
Temp2 = "4"
End Select
End Select
Temp1 = "HIMARK" & (i + 1) & Temp2
!FieldToBeUpdated = Temp1
.Update
End With
RsTemp.Close
Rs.MoveNext
Wend
Rs.Close
Next i
End Sub
Private Function OpenQuery(Sql As String, Optional QueryName As String = "") As rdoResultset
Dim Qod As New rdoQuery
Dim Ros As rdoResultset
If QueryName = "" Then QueryName = "Temp"
With Qod
.Name = QueryName
.Sql = Sql
Set .ActiveConnection = Cn
Set Ros = .OpenResultset(rdOpenKeyset, rdConcurRowVer)
End With
Set OpenQuery = Ros
End Function
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only