如何通过vb.net以编程方式附加服务器实例 [英] How to programmatically attach with server instance through vb.net

查看:82
本文介绍了如何通过vb.net以编程方式附加服务器实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我需要将驻留在应用程序文件夹的MyData目录中的数据库附加到客户端计算机上的SQL Server实例.怎么做?

任何机构都可以为我提供vb.net代码,以便我的应用程序在首次运行时可以做到吗?

谢谢

Hi,
I need to attach my database, that resided in the MyData directory of my application folder, to the instance of SQL server on client''s machine. How to do it?

Could any body give me vb.net code for that so my application does it when run for the first time?

Thanks

推荐答案

尝试一下,这可能对您有帮助

Try this, this may helps you

Server=.\SQLExpress;AttachDbFilename=c:\asd\qwe\mydbfile.mdf;Database=dbname; Trusted_Connection=Yes;



看到这里了解更多...

http://connectionstrings.com/sql-server-2008 [



See here for more ...

http://connectionstrings.com/sql-server-2008[^]

Thanks
--RA


我想为此重定向您.阅读并恢复原状

http://www.daniweb.com/software-development/vbnet/threads/84306 [ ^ ]
I want to redirect you on this. Have read and revert back with your stuck

http://www.daniweb.com/software-development/vbnet/threads/84306[^]


好,您需要使用ADO.NET.请参阅:
http://en.wikipedia.org/wiki/ADO.NET [ http://msdn.microsoft.com/en-us/library/aa286484.aspx [ ^ ].

另请参阅: http://www.devlist.com/ConnectionStringsPage.aspx [为初学者使用ADO.NET [ ^ ].

祝你好运,
—SA
Well, you need to use ADO.NET. Please see:
http://en.wikipedia.org/wiki/ADO.NET[^],
http://msdn.microsoft.com/en-us/library/aa286484.aspx[^].

See also: http://www.devlist.com/ConnectionStringsPage.aspx[^].

For starters, I advise this CodeProject article: Using ADO.NET for beginners[^].

Good luck,
—SA


这篇关于如何通过vb.net以编程方式附加服务器实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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