DapperLib / DapperLib/Dapper

@UniqueID error

Open
#2,024 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
18.4k
Forks
3.7k
Avg merge
5h 8m
Merged PRs (30d)
1

Description

Hi,
I've a table with a field named UniqueID, but when I try to insert or update through Dapper I get an error on the variable name

image

It seems like it's some kind of reserved word/variable name.
I'm using Dapper version 2.1.28 with Microsoft SQL Azure

I tried to escape it with [] but no way. The @UniqueID variable is present only one time.
If I remove the UniqueID field and variable from queries, all works fine.

These are my query:

`internal static readonly string INSERT_QUERY = "INSERT INTO pro_ordine_composizione (SocietaID,OrdineID,ArticoloID,RevisioneID,ComposizioneID,LogAdded,LogUpdated,LogCanceled,LogAddedUserID,LogUpdatedUserID,LogCanceledUserID,ComponenteArticoloID,ComponenteRevisioneID,ComposizioneIDPadre,RepartoID,ComponenteID,Posizione,Quantita,Tempo,Inizio,Fine,RisorsaID,ESummary,EMilestone,DescrizioneMS,UniqueID,EFisso,TempoAlPezzo,Note,Piazzamento,UID,QuantitaOriginale) OUTPUT INSERTED.rv VALUES(@SocietaID,@OrdineID,@ArticoloID,@RevisioneID,@ComposizioneID,SYSUTCDATETIME() AT TIME ZONE 'UTC' AT TIME ZONE 'Central Europe Standard Time',@LogUpdated,@LogCanceled,@LogAddedUserID,@LogUpdatedUserID,@LogCanceledUserID,@ComponenteArticoloID,@ComponenteRevisioneID,@ComposizioneIDPadre,@RepartoID,@ComponenteID,@Posizione,@Quantita,@Tempo,@Inizio,@Fine,@RisorsaID,@ESummary,@EMilestone,@DescrizioneMS,@UniqueID,@EFisso,@TempoAlPezzo,@Note,@Piazzamento,@UID,@QuantitaOriginale)";

internal static readonly string UPDATE_QUERY = "UPDATE pro_ordine_composizione SET SocietaID = @SocietaID,OrdineID = @OrdineID,ArticoloID = @ArticoloID,RevisioneID = @RevisioneID,ComposizioneID = @ComposizioneID,LogAdded = @LogAdded,LogUpdated = SYSUTCDATETIME() AT TIME ZONE 'UTC' AT TIME ZONE 'Central Europe Standard Time',LogCanceled = @LogCanceled,LogAddedUserID = @LogAddedUserID,LogUpdatedUserID = @LogUpdatedUserID,LogCanceledUserID = @LogCanceledUserID,ComponenteArticoloID = @ComponenteArticoloID,ComponenteRevisioneID = @ComponenteRevisioneID,ComposizioneIDPadre = @ComposizioneIDPadre,RepartoID = @RepartoID,ComponenteID = @ComponenteID,Posizione = @Posizione,Quantita = @Quantita,Tempo = @Tempo,Inizio = @Inizio,Fine = @Fine,RisorsaID = @RisorsaID,ESummary = @ESummary,EMilestone = @EMilestone,DescrizioneMS = @DescrizioneMS,UniqueID = @UniqueID,EFisso = @EFisso,TempoAlPezzo = @TempoAlPezzo,Note = @Note,Piazzamento = @Piazzamento,[UID] = @UID,QuantitaOriginale = @QuantitaOriginale OUTPUT INSERTED.rv WHERE SocietaID = @SocietaID AND OrdineID = @OrdineID AND ArticoloID = @ArticoloID AND RevisioneID = @RevisioneID AND ComposizioneID = @ComposizioneID AND rv = @rv";`

Regards

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the INSERT_QUERY and UPDATE_QUERY against Microsoft SQL Azure with Dapper 2.1.28, focusing on the @UniqueID parameter and the shown bracketed [UID] variant. Compare the reported error with the query text and verify that both operations complete with UniqueID present.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.