我们如何在Windows窗体应用程序中使用共享SQL Server数据库? [英] How can we use shared SQL Server database in windows form application?

查看:116
本文介绍了我们如何在Windows窗体应用程序中使用共享SQL Server数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了Windows表单应用程序,我想使用实时SQL Server数据库(共享主机SQL Server数据库)而不是本地SQL Server数据库。我使用过这个连接字符串:



数据源= seevername;初始目录= databasename;持久安全信息=真;用户ID =用户ID;密码=密码;


带有实时SQL Server数据库的
,但响应速度太慢。



有没有办法快速与实时SQL Server数据库进行通信?

解决方案

连接字符串对速度没有影响:它只是建立通信。其他一切都会影响速度。



从网络开始:PING服务器并确保返回的数字很好而且很低。对于LAN,我希望每次都<1ms。



然后检查你的代码:你一次拿几行?多少列?那里有像图像,音乐或视频这样的大数据?你的查询有多复杂?



尝试连接,获取单行的单个整数列并使用Stopwatch类实例对其进行计时。应该很快!



但是你必须自己做这件事 - 在大多数情况下 - 我们无法访问你的数据库,你的电脑,你的代码或屏幕! :笑:

I have created windows form application and I want to use live SQL Server database (shared hosting SQL Server database) instead of local SQL Server database. I have used this connection string:

Data Source=seevername;Initial Catalog=databasename;Persist Security Info=True;User ID=userid;password=password;

with live SQL Server database, but it's respond is too slow.

Is there any way to communicate fast with live SQL Server database?

解决方案

The connection string has no effect on speed: it just "establishes communications". Everything else will affect speed.

Start with the network: PING the server and make sure that the returned number is nice and low. For a LAN I'd expect <1ms every time.

Then check your code: how many rows are you fetching at a time? How many columns? Any BIG data like images, or music, or video in there? How complex are your queries?

Try connecting, fetching a single integer column of a single row and timing it using a Stopwatch class instance. Should be pretty quick!

But you are going to have to do this yourself, for the most part - we don't have access to your DB, your PC, your code or your screen! :laugh:


这篇关于我们如何在Windows窗体应用程序中使用共享SQL Server数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆