Android Question Types do not match

David Elkington

Active Member
Licensed User
Longtime User
Hi Everyone,

I have some code below (2nd line) that seems to have an underline saying types do not match, I can't see why, and it does not seem to work... It just freezes the app and I can't see where it goes

B4X:
Sub InsertLolerRequest
    
    Dim cmd As DBCommand = CreateCommand("insert_req_loler_31298", Array(1,0,1,Main.lngLolerKitID))
    Dim j As HttpJob = CreateRequest.Executebatch(cmd, Null)
    Wait For(j) JobDone(j As HttpJob)
    If j.Success Then
        Log("Inserted successfully!")
    End If
    j.Release
end sub

Any help would be appreciated, writing in b4a 10.0
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

David Elkington

Active Member
Licensed User
Longtime User
Hi Erel,

That tutorial is where I got the code from, I just adapted the createcommand in line 3 to insert into my table on SQL Server.

The SQL side is as below

sql.insert_req_loler_31298=INSERT INTO tbl_system_requests(sys_type_ID,sys_status,sys_parm_1,sys_parm_2) VALUES (?,?,?,?);
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
That tutorial is where I got the code from
No.

1595408122090.png
 
Upvote 0

David Elkington

Active Member
Licensed User
Longtime User
It appears it is not waiting.... If I put in some code and add a break point in JobDone, it goes through and pauses there. Is there a reason why it would not wait and then execute the lines below? I checked the SQL table, and it is actually writing to the table ok.
 
Upvote 0

David Elkington

Active Member
Licensed User
Longtime User
I get this now on compile, perhaps there is an issue here...

B4A Version: 10.0
Java Version: 8
Parsing code. (0.59s)
Building folders structure. (0.06s)
Compiling code. (3.21s)
Compiling layouts code. (0.42s)
Organizing libraries. (0.00s)
(Android Support Library)
Generating R file. (0.00s)
Compiling debugger engine code. (1.48s)
Compiling generated Java code. Error
B4A line: 1077
Dim j As HttpJob = CreateRequest.Execute
javac 1.8.0_131
src\b4a\riskassessment\loler_audit.java:2535: error: incompatible types: String cannot be converted to httpjob
_j = (b4a.riskassessment.httpjob)(_createrequest()._executebatch /*String*/ (null,anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_cmd)}),anywheresoftware.b4a.keywords.Common.Null));
 
Upvote 0

emexes

Expert
Licensed User
1/ Click on ExecuteBatch in IDE, see what the hint help says it returns. Error indicates is returning String, which is usually the default if not otherwise specified. Should be As HttpJob.

2/ Make sure ExecuteBatch is defined in your project, probably in file DBRequestManager.bas from:

https://www.b4x.com/android/forum/t...ation-of-rdc-remote-database-connector.61801/

B4X:
Public Sub ExecuteBatch(ListOfCommands As List, Tag As Object) As HttpJob
    Dim j As HttpJob = CreateJob
    ExecuteBatchImpl(j, ListOfCommands, Tag)
    Return j
End Sub
 
Upvote 0

David Elkington

Active Member
Licensed User
Longtime User
My public sub did not have the As HttpJob on the end, but I have not changed anything, do you think I am on an old version somehow? Mine is as below, looks nothing like yours

My Version of Execute batch:
Public Sub ExecuteBatch(ListOfCommands As List, Tag As Object)
    Dim ser As B4XSerializator
    ser.Tag = Tag
    ser.ConvertObjectToBytesAsync(CreateMap("commands": ListOfCommands,  "version": VERSION), "ser")
End Sub
 
Upvote 0
Top