SaharJabri
New Member
Dears,
I used to use JRDC to uploading the data to the BD server. But I have this project that I need to use JSON to get/post/update the data. I successfully download the data from the server but while updating the row its not working. in the code it goes as success but in the BD server it is not changing the row.
Here is the code I used for updating:
is there is any problem in my code?? or there is another way to do it.
I used to use JRDC to uploading the data to the BD server. But I have this project that I need to use JSON to get/post/update the data. I successfully download the data from the server but while updating the row its not working. in the code it goes as success but in the BD server it is not changing the row.
Here is the code I used for updating:
Json Updates query:
Dim dcdate As String = rs.GetString("Date")
Dim dclat As String = rs.GetString("Latitude")
Dim dclon As String = rs.GetString("Longitude")
Dim dcstat As String = rs.GetString("DCRCstatus")
Dim dcfrom As String = rs.GetString("DCRCfrom")
Dim dcreason As String = rs.GetString("Reason")
Dim dccommt As String= rs.GetString("Comments")
Dim dctime As String = rs.GetString("Date") & " " & rs.GetString("Time")
Dim dcuserid As Int = 265 'rs.GetString("StaffID")
Dim metread As Int = rs.GetString("ReaderID")
Dim acno As Int = rs.GetString("AccountNo")
Dim dcid As Int = rs.GetString("acoID")
'---------------------------------------------------------------------------------
'convert the photo from file to byte -------------
'---------------------------------------------------------------------------------
Dim LocationPic As String = rs.GetString("LocationDCRC")
Dim BeforeDC As String = rs.GetString("BeforeDC")
Dim afterDCRC As String = rs.GetString("AfterDCRC")
Dim MeterPhoto1 As String = rs.GetString("MeterPhoto")
Dim imgloc() As Byte
If(LocationPic <> "" And LocationPic <> ".png") Then
imgloc = FileToBytes(db1.Path,LocationPic)
End If
Dim imgbdc() As Byte
If(BeforeDC <> "" And BeforeDC <> ".png") Then
imgbdc = FileToBytes(db1.Path,BeforeDC)
End If
Dim imgadc() As Byte
If(afterDCRC <> "" And afterDCRC <> ".png") Then
imgadc = FileToBytes(db1.Path,afterDCRC)
End If
Dim imgmet() As Byte
If(MeterPhoto1 <> "" And MeterPhoto1 <> ".png") Then
imgmet = FileToBytes(db1.Path,MeterPhoto1)
End If
Dim MapMain As Map = CreateMap ("dcdate": $"${dcdate}"$, "dclat": $"${dclat}"$, "dclon": $"${dclon}"$,"dcstat": $"${dcstat}"$,"dcfrom": $"${dcfrom}"$, "dcreason": $"${dcreason}"$, "dccommt": $"${dccommt}"$,"dctime": $"${dctime}"$,"dcuserid": $"${dcuserid}"$, "metread": $"${metread}"$,"acno": $"${acno}"$,"dcid": $"${dcid}"$,"imgmet": $"${imgmet}"$, "imgbdc": $"${imgbdc}"$, "imgadc": $"${imgadc}"$,"imgloc": $"${imgloc}"$)
JSONGenerator.Initialize(MapMain)
Log(JSONGenerator.ToPrettyString(5).Replace("\", "").Replace("""[", "[").Replace("]""", "]")) 'REMOVE UNNECESSARY CHARACTERS
'Post request for ticker data via the JSON generated string
Dim J As HttpJob
J.Initialize(Null, Me)
J.PostString($"https:Link"$, JSONGenerator.ToString.Replace("\", "").Replace("""[", "[").Replace("]""", "]")) 'REMOVE UNNECESSARY CHARACTERS
J.GetRequest.SetContentType("application/json; charset=utf-8")
Wait For (J) JobDone(j As HttpJob)
Log(J.Success)
If J.Success Then
Log("Success")
' Log("J.GetString: " & J.GetString)
Else
Log("Error")
ToastMessageShow("There is a problem in the connection, Please check your internet !!", True)
End If
is there is any problem in my code?? or there is another way to do it.
Last edited: