Hi, I have an MS SQL server for which I have the 'sa' password and I am trying to send a command, please see below: -
The command set_Insert_On=SET IDENTITY_INSERT SWArchive ON
j.Success says true after execution but I can't follow up with an insert into the 'SWArchive' table as it comes up with the error '(SQLException) java.sql.SQLException: Cannot insert explicit value for identity column in table 'SWArchive' when IDENTITY_INSERT is set to OFF' which tends to indicate that the command has not been successful.
Is there something wrong with the command I am sending or the way that I am doing it?
B4X:
Private Sub SetInsertOn
'Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("set_Insert_On", Null)
Dim j As HttpJob = CreateRequest.ExecuteCommand(cmd, Null)
Wait For(j) JobDone(j As HttpJob)
If j.Success = True Then
InsertData
End If
j.Release
End Sub
The command set_Insert_On=SET IDENTITY_INSERT SWArchive ON
j.Success says true after execution but I can't follow up with an insert into the 'SWArchive' table as it comes up with the error '(SQLException) java.sql.SQLException: Cannot insert explicit value for identity column in table 'SWArchive' when IDENTITY_INSERT is set to OFF' which tends to indicate that the command has not been successful.
Is there something wrong with the command I am sending or the way that I am doing it?