当前位置: 首页>>代码示例>>C#>>正文


C# NpgsqlConnectionStringBuilder.Add方法代码示例

本文整理汇总了C#中Npgsql.NpgsqlConnectionStringBuilder.Add方法的典型用法代码示例。如果您正苦于以下问题:C# NpgsqlConnectionStringBuilder.Add方法的具体用法?C# NpgsqlConnectionStringBuilder.Add怎么用?C# NpgsqlConnectionStringBuilder.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Npgsql.NpgsqlConnectionStringBuilder的用法示例。


在下文中一共展示了NpgsqlConnectionStringBuilder.Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ConStr

        public NpgsqlConnectionStringBuilder ConStr()
        {
            string myConnectionString = "";
            NpgsqlConnectionStringBuilder builder = new NpgsqlConnectionStringBuilder(myConnectionString);

            builder.Add("Server", textServer.Text);
            builder.Add("Port", textPort.Text);
            builder.Add("User", textUser.Text);
            builder.Add("Password", textPas.Text);
            builder.Add("Database", textBase.Text);

            return builder;
        }
开发者ID:BiSerge,项目名称:DemoBasePgSQL,代码行数:13,代码来源:Logins.cs

示例2: MainForm

        public MainForm()
        {
            InitializeComponent();
            RecordsProgressBar.Maximum = RecordsMax;
            _count = 0;
            _close = false;
            _threadsCounter = 0;

            DbConnectionStringBuilder connectionStringBuilder = new NpgsqlConnectionStringBuilder();
            connectionStringBuilder.Add("Server", "localhost");
            connectionStringBuilder.Add("Port", "5432");
            connectionStringBuilder.Add("User Id", "postgres");
            connectionStringBuilder.Add("Password", "1");
            connectionStringBuilder.Add("Database", "project");
            _dbConnectionString = connectionStringBuilder.ToString();
        }
开发者ID:kazami-yuuji,项目名称:dbParser,代码行数:16,代码来源:MainForm.cs

示例3: Connect

		private void Connect()
		{
			lock (_oSyncRoot)
			{
				if (null != _cTransaction)
					return;
				try
				{
					if (null != _cConnection && ConnectionState.Closed != _cConnection.State)
						_cConnection.Close();
				}
				catch { }
				Npgsql.NpgsqlConnectionStringBuilder sConnectionString = new NpgsqlConnectionStringBuilder();
				sConnectionString.Add("Server", _cCredentials.sServer);
				sConnectionString.Add("Port", _cCredentials.nPort);
				sConnectionString.Add("User Id", _cCredentials.sUser);
				sConnectionString.Add("Password", _cCredentials.sPassword);
				sConnectionString.Add("Database", _cCredentials.sDatabase);
				sConnectionString.Add("Timeout", _cCredentials.nTimeout);
                sConnectionString.Add("CommandTimeout", _cCredentials.nTimeout);
                _sLastQuery = sConnectionString.ToString().Replace("\\;", ";") + ";Encoding=Unicode;";
				_cConnection = new NpgsqlConnection(_sLastQuery);
				_sLastQuery = "Connect to server: " + _sLastQuery;
				_cConnection.Open();
				if (null != _cCredentials.sRole && 0 < _cCredentials.sRole.Length)
					(new NpgsqlCommand("SET ROLE " + _cCredentials.sRole, _cConnection)).ExecuteNonQuery();
				if(Preferences.ByteaOutput.server != Preferences.eByteaOutput)
					(new NpgsqlCommand("SET bytea_output TO " + Preferences.eByteaOutput, _cConnection)).ExecuteNonQuery();
			}
		}
开发者ID:ratsil,项目名称:bethe.helpers,代码行数:30,代码来源:DB.cs


注:本文中的Npgsql.NpgsqlConnectionStringBuilder.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。