I'm developing an App on Android for my comany, only internal use.
The database consists of several BLOB fields. The App saves taken pictures into the DB.
The function to write one of the taken pictures into the database is as follows:
When i debug this code the MySqlquery variable contains the following string:
This seems pretty nice and correct to me.
When the call ExecNonQuery2 is executed I get the following error:
So I'm missing something in MySqlquery variable. I don't see what, any help :sign0085: appreciated!
Best regards,
Albert
The database consists of several BLOB fields. The App saves taken pictures into the DB.
The function to write one of the taken pictures into the database is as follows:
B4X:
Sub InsertIntake1FotoBlob
Log("> InsertIntake1FotoBlob, " & DateTime.Time(DateTime.Now) & "(" & DateTime.Now & ")")
'convert the image file to a bytes array
Dim InputStream1 As InputStream
InputStream1 = File.OpenInput("/storage/sdcard0/TF_Worklist_Loadcells/", "IntakeFoto1.jpg")
Dim OutputStream1 As OutputStream
OutputStream1.InitializeToBytesArray(1000000)
File.Copy2(InputStream1, OutputStream1)
Dim Buffer() As Byte 'declares an empty array
Buffer = OutputStream1.ToBytesArray
'write the image to the database
Dim MySqlquery As String
MySqlquery="UPDATE " & DbMainTableName & _
" SET " & MainTableColumnNames(48) & " = '?' " & _
"WHERE " & MainTableColumnNames(0) & " = '" & txtMainTableColumnNames0.Text & _
"' AND " & MainTableColumnNames(3) & " = '" & TxtProjectReferentie.Text & _
"' AND " & MainTableColumnNames(7) & " = '" & TxtSerienummer.Text & "'"
MySql.ExecNonQuery2(MySqlquery, Array As Object(Buffer))
Log("< InsertIntake1FotoBlob, " & DateTime.Time(DateTime.Now) & "(" & DateTime.Now & ")")
End Sub
When i debug this code the MySqlquery variable contains the following string:
B4X:
"UPDATE DB_WorklistLoadcells SET IntakeControlPhoto1 = '?' WHERE OID = '1' AND ProjectReference = '212999' AND Serial = 'TFL-3175kN-129999'"
When the call ExecNonQuery2 is executed I get the following error:
B4X:
'LastException java.lang.IllegalArgumentException: Cannot bind argument at index 1 because the index is out of range. The statement has 0 paramters.'
Best regards,
Albert