Hi,
I am trying to save the readings from a Level Observation into a SQLite database. When reading the Backsight on a Benchmark, fields such as Foresight, Adjustment, etc. will be blank. I have tried the following code, but it does not work:
Private Sub SaveLevelBook(A As Int)
Dim Text As String
Query = "INSERT INTO LevelBook VALUES (?,?,?,?,?,?,?,?)"
If A = 1 Then
'Collimation
Text = "" & "','" & "" & "','" & "" & "','" & NumberFormat2(CGlobals.CM, 1,3,3,False) & "','" & "" & "','" & "" & "','" & "" & "','" & ""
Else If A = 2 Then
'Backsight
If PntName.Text <> "" Then
Text = NumberFormat2(BSight.Text,1,3,3,False) & "','" & "" & "','" & "" & "','" & NumberFormat2(CGlobals.CM, 1,3,3,False) & "','" & "" & "','" & "" & "','" & "" & "','" & PntName.Text
Else
Text = NumberFormat2(BSight.Text,1,3,3,False) & "','" & "" & "','" & "" & "','" & NumberFormat2(CGlobals.CM, 1,3,3,False) & "','" & "" & "','" & "" & "','" & "" & "','" & "B\S"
End If
Else If A = 3 Then
'Intermediate
'Text = Text & "" & "','" & Format(CDbl(IntRead.Text), "F3") & "','" & "" & "','" & "" & "','" & Format(CDbl(RLevel.Text), "F3") & "','" & "" & "','" & "" & "','" & IntRemarks.Text & "')"
Else If A = 4 Then
'Foresight
If FSRemarks.Text <> "" Then
Text = "" & "','" & "" & "','" & NumberFormat2(FSRead.Text, 1,3,3,False) & "','" & "" & "','" & NumberFormat2(FSLevel.Text, 1,3,3,False) & "','" & "" & "','" & "" & "','" & FSRemarks.Text
Else
Text = "" & "','" & "" & "','" & NumberFormat2(FSRead.Text, 1,3,3,False) & "','" & "" & "','" & NumberFormat2(FSLevel.Text, 1,3,3,False) & "','" & "" & "','" & "" & "','" & "F\S"
End If
End If
CGlobals.SQL1.ExecNonQuery2(Query, Array As String(Text))
ToastMessageShow("Fieldbook Updated", False)
End Sub
Any advise please?
I am trying to save the readings from a Level Observation into a SQLite database. When reading the Backsight on a Benchmark, fields such as Foresight, Adjustment, etc. will be blank. I have tried the following code, but it does not work:
Private Sub SaveLevelBook(A As Int)
Dim Text As String
Query = "INSERT INTO LevelBook VALUES (?,?,?,?,?,?,?,?)"
If A = 1 Then
'Collimation
Text = "" & "','" & "" & "','" & "" & "','" & NumberFormat2(CGlobals.CM, 1,3,3,False) & "','" & "" & "','" & "" & "','" & "" & "','" & ""
Else If A = 2 Then
'Backsight
If PntName.Text <> "" Then
Text = NumberFormat2(BSight.Text,1,3,3,False) & "','" & "" & "','" & "" & "','" & NumberFormat2(CGlobals.CM, 1,3,3,False) & "','" & "" & "','" & "" & "','" & "" & "','" & PntName.Text
Else
Text = NumberFormat2(BSight.Text,1,3,3,False) & "','" & "" & "','" & "" & "','" & NumberFormat2(CGlobals.CM, 1,3,3,False) & "','" & "" & "','" & "" & "','" & "" & "','" & "B\S"
End If
Else If A = 3 Then
'Intermediate
'Text = Text & "" & "','" & Format(CDbl(IntRead.Text), "F3") & "','" & "" & "','" & "" & "','" & Format(CDbl(RLevel.Text), "F3") & "','" & "" & "','" & "" & "','" & IntRemarks.Text & "')"
Else If A = 4 Then
'Foresight
If FSRemarks.Text <> "" Then
Text = "" & "','" & "" & "','" & NumberFormat2(FSRead.Text, 1,3,3,False) & "','" & "" & "','" & NumberFormat2(FSLevel.Text, 1,3,3,False) & "','" & "" & "','" & "" & "','" & FSRemarks.Text
Else
Text = "" & "','" & "" & "','" & NumberFormat2(FSRead.Text, 1,3,3,False) & "','" & "" & "','" & NumberFormat2(FSLevel.Text, 1,3,3,False) & "','" & "" & "','" & "" & "','" & "F\S"
End If
End If
CGlobals.SQL1.ExecNonQuery2(Query, Array As String(Text))
ToastMessageShow("Fieldbook Updated", False)
End Sub
Any advise please?