SQLLite

ceaser

Active Member
Licensed User
Hi All:sign0085:

I get to grips with B4PPC - with everything, except SQLLte:sign0148: I have the following code where I can store a coordinate or update a coordinate::sign0148:

Sub SaveCoord_Click
Dim a

ErrorLabel (NoPoint)
If PntName.Text<>"" Then
If CFile=0 Then
text="update LCoords Set YCoord = '"
Else If CFile=1 Then
text="update LCoords Set YCoord = '"
Else
text="update LCoords Set YCoord = '"
End If
Text=Text & YCoord.Text & "'," & "XCoord = '" & XCoord.Text & "'," & "ZCoord = '" & ZCoord.Text
Text=Text & "'," & "Description = '" & Descrip.Text & "'"
Text=Text & " where PntName = '" & PntName.Text &"'"
cmd.CommandText=text
A=cmd.ExecuteNonQuery
*** If A=1 Then
'Point exits
Msgbox ("Point Exists - Override?", "Point Exits", cMsgboxYesNo, cMsgboxQuestion)
End If **
If A=0 Then Goto NoPoint
ShowCoords(1,CFile)
Return
Else
Msgbox ("Enter A Valid Point Name", "Point Name", cMsgboxOK, cMsgboxExclamation)
PntName.Focus
Return
End If

NoPoint:
'The point does not exist so add the new point
If CFile=0 Then
text="insert into LCoords (PntName,YCoord,XCoord,ZCoord,Description) values ('"
Else If CFile=1 Then
text="insert into GCoords (PntName,YCoord,XCoord,ZCoord,Description) values ('"
Else
text="insert into SCoords (PntName,YCoord,XCoord,ZCoord,Description) values ('"
End If
text=text & PntName.Text & "','" & YCoord.Text & "','" & XCoord.Text & "','" & ZCoord.Text & "','" & Descrip.Text & "')"
cmd.CommandText=text
cmd.ExecuteNonQuery
ShowCoords(1,CFile)
End Sub

Looking at the line codes marked with an astrixs, is where when A=1, the point exists and the new values get updated. How can I "Rollback" that command or have another command to check if the point exists before the values get changed in the database?

Thanks
Michael
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…