markrendle / Simple.Data

A light-weight, dynamic data access component for C# 4.0
MIT License
1.33k stars 303 forks source link

SqlServer: Tables with hyphen in their name cause Insufficient permissions exception #333

Open Ashthos opened 10 years ago

Ashthos commented 10 years ago

When using a string typed table name with UpdateAll you cannot commit changes to the table.

Example Below:

using (var transaction = _db.BeginTransaction())
{
     _db["My-Table"].UpdateAll(
     _db["My-Table"].SomeValue == someValue, // Condition
    Status: Unallocated, // Updates
    SomethingElse: null);

    transaction.Commit();  // Exception thrown here..
}

Workaround: Don't use hyphens in tablenames