开发者

SqlDataAdapter Update

开发者 https://www.devze.com 2022-12-23 07:24 出处:网络
Can any one help me why this error occurs when i update using sqlDataadapter with j开发者_如何转开发oin query

Can any one help me why this error occurs when i update using sqlDataadapter with j开发者_如何转开发oin query

Dynamic SQL generation is not supported against multiple base tables.


You have a "join" in your main query for your dataset (The first one in the TableAdapter with a check by it). You can't automatically generate insert/update/delete logic for a TableAdapter when the main query has multiple tables referenced in the query via a join. The designer isn't smart enough to figure out which table you want to send updates to in that case, that is why you get the error message.

Solution. Ensure that your main query only references the table you want the designer to write insert/update/delete code for. Your secondary queries may reference as many tables as you want.


It was in the case that i was trying to set value for identity column in my datarow. Simply i deleted the code to set value for identity column and it will work.

My Scenario:

Database: uin [primary, identity] name address

Whenever i tried to set the datarow("uin") the error occurs. But works fine with datarow("name") and datarow("address").

Hope it works for you too

0

精彩评论

暂无评论...
验证码 换一张
取 消