通过ADO.net在SQL中未发生插入 [英] Insert not happening in SQL through ADO.net
问题描述
我正在一个应用程序中,我正在其中从数据库表中填充控件,为此,我编写了linq查询来获取数据.
可以从数据库获取数据,但是当我尝试在表中插入值时,它什么也没做.值未存储在表中,并且执行相同操作时未生成任何错误或异常.
我正在使用这段代码来插入值.
I am working on an application where i am populating controls from the database table, for this i have written linq query to fetch the data.
The data can be fetched from the databse but when i try to insert values in the table it just doesn;t do anything. The values are not getting stored in the table and there is no error or exception generated while doing the same.
I am using this piece of code to insert the value.
Tasks tsk = new Tasks
{
game_id = 1,
platform_id = 1,
version_id = 1,
description = "abcd",
activity_name = "abcd",
projected_start_date = Convert.ToDateTime("01/13/2010"),
projected_end_date = Convert.ToDateTime("01/14/2010"),
duration = 1,
parent_task_id = 1
};
svcContext.MergeOption = MergeOption.AppendOnly;
svcContext.AddObject("Tasks", tsk);
svcContext.UpdateObject(tsk);
我已经尝试过使用BeginSavechanges:doh:以及endSave更改,但这也没有用.
我坚持这一点,对此的任何帮助将不胜感激. :)
i have tried using BeginSavechanges :doh: as well as endSave changes but that also didnt work.
I am stuck with this and any help of this will be greatly appreciated. :)
推荐答案
使用ADO.Net的Silverlight吗?
Silverlight中没有ADO.Net.
Silverlight with ADO.Net?
There is no ADO.Net in Silverlight.
^ ],ADO.NET和silverlight之间存在一些联系.我猜想表所在的位置存在问题,也许有一个本地副本被修改,然后被服务器替换了?我建议阅读我链接的文章,以了解ADO.NET如何与silverlight一起工作.我猜想数据库是否在服务器上,那Silverlight会使用Web服务与之对话.
According to Bing[^], there is some connection between ADO.NET and silverlight. I would guess that there''s an issue with where the table lives, and perhaps there''s a local copy that gets modified by then replaced by the server one ? I would suggest reading up on the article I linked to, to understand how ADO.NET works with silverlight. I''d have guessed if the DB was on a server, that silverlight would use webservices to talk to it.
这篇关于通过ADO.net在SQL中未发生插入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!