diff --git a/Dapper.Rainbow/Database.cs b/Dapper.Rainbow/Database.cs index 12f1ef1cb..758c35c0d 100644 --- a/Dapper.Rainbow/Database.cs +++ b/Dapper.Rainbow/Database.cs @@ -56,7 +56,7 @@ public string TableName List paramNames = GetParamNames(o); paramNames.Remove("Id"); - string cols = string.Join(",", paramNames.Select(p => "[" + p + "]")); + string cols = string.Join(",", paramNames); string cols_params = string.Join(",", paramNames.Select(p => "@" + p)); var sql = "set nocount on insert " + TableName + " (" + cols + ") values (" + cols_params + ") select cast(scope_identity() as int)"; @@ -75,7 +75,7 @@ public int Update(TId id, dynamic data) var builder = new StringBuilder(); builder.Append("update ").Append(TableName).Append(" set "); - builder.AppendLine(string.Join(",", paramNames.Where(n => n != "Id").Select(p => "[" + p + "] = @" + p))); + builder.AppendLine(string.Join(",", paramNames.Where(n => n != "Id").Select(p => p + "= @" + p))); builder.Append("where Id = @Id"); DynamicParameters parameters = new DynamicParameters(data); diff --git a/Dapper.Rainbow/SqlCompactDatabase.cs b/Dapper.Rainbow/SqlCompactDatabase.cs index 1cc0e41ec..e04633dd0 100644 --- a/Dapper.Rainbow/SqlCompactDatabase.cs +++ b/Dapper.Rainbow/SqlCompactDatabase.cs @@ -25,7 +25,7 @@ public SqlCompactTable(Database database, string likelyTableName) List paramNames = GetParamNames(o); paramNames.Remove("Id"); - string cols = string.Join(",", paramNames.Select(p => "[" + p + "]")); + string cols = string.Join(",", paramNames); string cols_params = string.Join(",", paramNames.Select(p => "@" + p)); var sql = "insert " + TableName + " (" + cols + ") values (" + cols_params + ")";