SQL Server 2008 Express 一行写入

发布于 2024-09-04 07:03:38 字数 434 浏览 8 评论 0原文

我在使用 SQL Server Express 2008 时遇到了最奇怪的问题(至少对我来说很奇怪)。

问题如下:

在开发计算机上,我使用 SQL Server 2008 Enterprise....我从 WCF 服务获取一些数据,并且将数据写入数据库(尽可能简单)......但是我应该指出,写入是在单独的线程中完成的。但是,无论如何,在开发过程中没有问题......所有数据都在那里。

然后我在 Release 中设置所有内容(连接字符串 .\SQLEXPRESS,其他设置)并将其复制到安装了 SQL Server Express 的测试机器(因为我的应用程序是客户端应用程序,它应该与 Express 一起使用)...我运行程序...程序从服务中检索数据...当我查看数据库时...我大吃一惊...只写入了一行(从WCF 服务)。

我真的很感激任何帮助......我在这里陷入僵局。

I have the most bizarre problem (at least it is bizarre to me) with SQL Server Express 2008.

The problem is the following:

On the development machine I use SQL Server 2008 Enterprise....I get some data from a WCF service and write that data to the database (simple as it can be)....I should point out however that the writing, it is done in a separate thread. But, anyway no problems during development...all the data is there.

Then I set everything up(connection strings .\SQLEXPRESS, other settings) build in Release and copy that to a test machine that has SQL Server Express installed (because my application is a client application and it should work with Express)... I run the program.... the program retrieves the data from the service... and when I look at the database... I'm in for a big surprise... there's only one row written (the first row received from the WCF service).

I would really appreciate any help...I'm in a deadlock here.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

幽蝶幻影 2024-09-11 07:03:39

好吧,有人会发现这很有趣...

经过彻底分析后,发生了这种情况:

我将正在将数据写入在不同线程中运行的数据库的代码移动到与 GUI 相同的线程...并且没有问题它工作正常...它将所有数据写入数据库。

我进一步查看,发现网上一篇文章说 SQL Express 只有一个调度程序(当然还有一个处理器等)...因此它不支持同时向数据库写入多个线程(任何人其他人对此了解更多吗?)...因此,解决方案可能是创建一个队列,然后在数据到达时将其发送到队列,并将数据一一写入数据库。

OK, someone will find this interesting...

After a thorough analysis this happened:

I moved the code that was writing the data to the db that was running in a different thread to the same thread as the GUI....and no problem it works fine...it writes all the data to the database.

I looked further on and came up on an article on the web saying that SQL Express has only one scheduler(and of course one processor etc.)...and therefore it doesn't support multiple threads writing to the database at once(anyone else knows more about this?)...therefore the solution for this is probably creating a queue and just send stuff to it as it arrives and write data one by one to the database.

咆哮 2024-09-11 07:03:38

您能够分析 sql 服务器上实际调用的内容吗?

打开 sql server profiler,指向 sql express 实例并确保拉取 RPC:Completed 和 Sql Statement Completed。您可以取消选中默认值的其余部分,这可能会告诉您它如何在服务器上以不同的方式调用它。

其他想法:
命令类型是否正确?

顶部怎么会滑进去?

Are you able to profile what is actually being called on the sql server?

Open up the sql server profiler, point the sql express instance and make sure you pull the RPC:Completed and Sql Statement Completed. You can uncheck the rest of the default, this might be able to tell you how its possibly calling it differently on the server.

Other thoughts:
Is the command type correct?

Is a top slipping in there some how?

爱本泡沫多脆弱 2024-09-11 07:03:38

仔细检查所有内容(尤其是连接字符串)。让您的应用程序输出一个日志文件,这可能有助于调试您的问题。

还要检查主数据库,以确保条目不会无意中写入开发数据库。

Double-check everything (especially connection strings). Have your app output a log file which might help debug your problem.

Check the main DB also to make sure the entries aren't inadvertently written to the development database.

﹉夏雨初晴づ 2024-09-11 07:03:38

你有没有机会设置(我知道这不太可能)

set ROWCOUNT 1 

Have you by any chance set(I know this is unlikely)

set ROWCOUNT 1 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文