Punikin


There was an error parsing the query. [ Token line number = 8,Token line offset = 26,Token in error = UPDATE ]

*********************** START CODE ***********************

CmdString = @"INSERT INTO tbl_document

(Batch_id, DocLastUser_id, FileDrawer_id, ParentDocument_id, DocCount, PageNumber, FileName, FileSize, FileCRC, DocIndexed, DocVerified,

DocCommitted, DocOCR, DocLastUpdated, SynchronizationKey)

VALUES (@Batch_id,@DocLastUser_id,@FileDrawer_id, -10, @DocCount, @PageNumber, @FileName, @FileSize, @FileCRC, @DocIndexed, @DocVerified, @DocCommitted, @DocOCR, GETDATE(), @Batch_id

+ N'_' +@FileName + N' _' + GETDATE())

UPDATE tbl_document

SET ParentDocument_id = @@IDENTITY

WHERE (Document_id = @@IDENTITY)";

ReturnCmd = New SqlCeCommand(CmdString, conn);

ReturnCmd.CommandType = CommandType.Text;

// Adds Parameters to cmd.Parameters

GetDBParameter(cmd.Parameters, inDb2Use, "@DocLastUser_id", Globals.gUserID);

GetDBParameter(cmd.Parameters, inDb2Use, "@DocCount", inObject2Insert.Count);

GetDBParameter(cmd.Parameters, inDb2Use, "@PageNumber", inObject2Insert.PageNumber);

GetDBParameter(cmd.Parameters, inDb2Use, "@FileName", inObject2Insert.FilePath);

GetDBParameter(cmd.Parameters, inDb2Use, "@FileSize", inObject2Insert.FileSize);

GetDBParameter(cmd.Parameters, inDb2Use, "@FileCRC", inObject2Insert.FileCRC);

GetDBParameter(cmd.Parameters, inDb2Use, "@DocIndexed", inObject2Insert.Indexed);

GetDBParameter(cmd.Parameters, inDb2Use, "@DocVerified", inObject2Insert.Verified);

GetDBParameter(cmd.Parameters, inDb2Use, "@DocCommitted", inObject2Insert.Committed);

GetDBParameter(cmd.Parameters, inDb2Use, "@Batch_id", inObject2Insert.Batch_id);

GetDBParameter(cmd.Parameters, inDb2Use, "@FileDrawer_id", inObject2Insert.FileDrawer_id);

GetDBParameter(cmd.Parameters, inDb2Use, "@DocOCR", inObject2Insert.OCR);

GetDBParameter(cmd.Parameters, inDb2Use, "@Id", SqlDbType.Int, True);

cmd.ExecuteScalar()

*********************** END CODE ***********************

Is it that you cannot run more than one cmd type per cmd, or is there someother call that i need to make I've made other calls to the database for Inserts and Updates and Gets, they all work fine.

Please help ASAP




Re: There was an error parsing the query

João Paulo Figueira


SQL Compact Edition only executes one SQL command at a time, unlike SQL Server. You must split your command into two invocations, INSERT and then UPDATE.