[英]VB.NET connection string for client-server application
Case : 案件 :
I'm creating a desktop application with VB.NET (Windows Forms), and using SQL Server 2008 Express for its database. 我正在使用VB.NET(Windows窗体)创建桌面应用程序,并将SQL Server 2008 Express用于其数据库。
Problem : 问题:
I want to create a client-server application, it means I just need 1 database on the server. 我想创建一个客户端-服务器应用程序,这意味着我在服务器上只需要1个数据库。
I have a computer and a laptop. 我有一台电脑和一台笔记本电脑。 I set my laptop's IP to
192.168.1.1
and my computer's IP to 192.168.1.2
. 我将笔记本电脑的IP设置为
192.168.1.1
并将计算机的IP设置为192.168.1.2
。
Now I place the database on my computer, the database name is db_transportasi
. 现在,将数据库放置在计算机上,数据库名称为
db_transportasi
。
Problem is, how to connect my computer's database from my laptop? 问题是,如何从笔记本电脑连接计算机的数据库?
Specification : 规格:
I'm using this string below for my connection : 我在下面使用此字符串进行连接:
Data Source=ARVID-THEODORUS\SQLEXPRESS;Initial Catalog=DB_TRANSPORTASI;Integrated Security=True
I already setup my SQL Configuration Manager, enabled the TCP/IP, switch to the IP Addresses
tab and set the IPAII Port Properties to 2301 我已经设置了我的SQL配置管理器,启用了TCP / IP,切换到
IP Addresses
选项卡,并将IPAII端口属性设置为2301
I turned off my firewall so I don't have to set any exception. 我关闭了防火墙,因此不必设置任何例外。
Here is the SQL Server SS : 这是SQL Server SS:
Question : 题 :
How to connect to my computer's database from my laptop? 如何从笔记本电脑连接到计算机的数据库?
Could you show me the example for my laptop VB.NET Connection String? 您能给我看看我的笔记本电脑VB.NET连接字符串的例子吗?
Thanks before. 之前谢谢。
There you go: 你去了:
"Server=192.168.1.2,1433;Initial Catalog=DB_TRANSPORTASI;Integrated Security=True"
ConnectionStrings.com is a good resource for connection strings for many different databases. ConnectionStrings.com是许多不同数据库的连接字符串的理想资源。
try this link: 试试这个链接:
http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/ http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/
connection string: 连接字符串:
"Network Library=DBMSSOCN; Data Source=xxx.xxx.xxx.xxx,1433;" & _
"Initial Catalog=mySQLServerDBName; User ID=myUsername;" & _
"Password=myPassword"
Try this page. 试试这个页面。 A whole list of different ways.
不同方式的完整列表。
http://www.connectionstrings.com/sql-server-2008 http://www.connectionstrings.com/sql-server-2008
确保在SQL Server配置管理器中启动“ SQL Server Browser”服务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.