我試圖通過F#typeprovider datacontext插入數據。我在數據庫dbo.tbl_Location
中有一個表,想用下面的簡單查詢插入數據。在F#typeprovider插入查詢中使用datacontext'''錯誤的語法
let InsertTaskDetails() =
dbSchema.GetDataContext().DataContext.ExecuteCommand("Insert into dbo.tbl_Location (LocationId,Location) Values (11, 'india')")
dbSchema.GetDataContext().DataContext.SubmitChanges()
但我得到的錯誤:
Incorrect syntax near ','
我不明白髮生了什麼,當我在SQL Server 2008中
Insert into dbo.tbl_Location (LocationId,Location) Values (11, 'india')
它工作正常運行相同的查詢。 LocationId
是int
類型和Location
是string
類型。
如果有人有關於它的想法,請告訴我我在哪裏丟失的東西。
呃,你使用什麼樣的DataContext?如果是EF,它不理解SQL。 –