Closed ras254 closed 8 years ago
can you provide the sample?
Data model
[TableName("doc")]
public class Doc
{
[PrimaryKey, NotNull, MapField("Record Number")]
public String Id { get; set; }
[MapField("Subject"), Nullable]
public String Subject { get; set; }
[MapField("Record Title"), Nullable]
public String RecordTitle { get; set; }
}
Problem code
using (var db = new DbManager(new Sql2008DataProvider(), connectionString))
{
var docs = db.GetTable<Doc>().Where(d => d.Id == "000").ToList();
db.Update((IEnumerable<Doc>)docs); // Exception here
}
Db table
CREATE TABLE [dbo].[doc](
[Record Number] [nvarchar](255) NOT NULL,
[Subject] [nvarchar](255) NULL,
[Record Title] [nvarchar](255) NULL
,
CONSTRAINT [doc$PrimaryKey] PRIMARY KEY CLUSTERED
(
[Record Number] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
please, check and close issue if fixed
Fixed, thanks
Db: MS SQL 2008 Wrong parameter name (with space) if column name contains space also.
For this operation
DbManager.Update(IEnumerable<T>);
Incorrect syntax near 'nvarchar'. Must declare the scalar variable "@Record". Statement(s) could not be prepared.
Update: this is a problem code... https://github.com/igor-tkachev/bltoolkit/blob/master/Source/Data/Sql/SqlProvider/MySqlSqlProvider.cs#L197