0

I want to know how I can set a GUID parameter for my entitydatasource. This is what I have currently:

 <asp:EntityDataSource ID="AccountsEntityDataSource" runat="server" 
        ConnectionString="name=AccountsEntities" 
        DefaultContainerName="AccountsEntities" EnableDelete="True" 
        EnableFlattening="False" EnableInsert="True" EnableUpdate="True" Where="it.BatchID = @BatchID"
        EntitySetName="Accounts">
          <WhereParameters>
        <asp:Parameter Name="BatchID" Type="String" />
    </WhereParameters>
    </asp:EntityDataSource>

In the backend I have this:

AccountsEntityDataSource.WhereParameters("BatchID").DefaultValue = Request.QueryString("BatchID")

And I'm getting this error:

The argument types 'Edm.Guid' and 'Edm.String' are incompatible for this operation. Near WHERE predicate, line 6, column 12.

Any idea what can I change?

halfer
  • 19,824
  • 17
  • 99
  • 186
Laziale
  • 7,965
  • 46
  • 146
  • 262

1 Answers1

0

You can escape it with the keyword GUID followed by a space i.e.

Where="it.BatchID = GUID '@BatchID'"

MSDN Reference

hutchonoid
  • 32,982
  • 15
  • 99
  • 104