一句winform连接数据库语句
publicstaticSqlConnectionconn=newSqlConnection("datasource=127.0.0.1;initialcatalog=W...
public static SqlConnection conn = new SqlConnection("data source=127.0.0.1;initial catalog=WebRollCall;persist security info=False;user id=sa;password=sa;workstation id=127.0.0.1;packet size=4096");
几个IP啊什么的详细介绍下就行。。 展开
几个IP啊什么的详细介绍下就行。。 展开
1个回答
展开全部
ConnectionString详细定义在MSDN里解释的很详细,还能练习阅读,呵呵
简单的摘录你问的几项内容,只翻译了短的句子:
Data Source :
The name or network address of the instance of SQL Server to which to connect. The port number can be specified after the server name:
server=tcp:servername, portnumber
When specifying a local instance, always use (local). To force a protocol, add one of the following prefixes:
np:(local), tcp:(local), lpc:(local)
Initial Catalog:数据库的名字
Persist Security Info:When set to false or no (strongly recommended), security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state. Resetting the connection string resets all connection string values including the password. Recognized values are true, false, yes, and no.
User ID:登录账号
Password:登录密码
Workstation ID:连接到数据库服务器的工作站ID或者IP
Packet Size:与数据库通信的数据包大小。
简单的摘录你问的几项内容,只翻译了短的句子:
Data Source :
The name or network address of the instance of SQL Server to which to connect. The port number can be specified after the server name:
server=tcp:servername, portnumber
When specifying a local instance, always use (local). To force a protocol, add one of the following prefixes:
np:(local), tcp:(local), lpc:(local)
Initial Catalog:数据库的名字
Persist Security Info:When set to false or no (strongly recommended), security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state. Resetting the connection string resets all connection string values including the password. Recognized values are true, false, yes, and no.
User ID:登录账号
Password:登录密码
Workstation ID:连接到数据库服务器的工作站ID或者IP
Packet Size:与数据库通信的数据包大小。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询