本文整理汇总了C#中FdoToolbox.Core.Feature.FdoConnection.GetConnectTimeProperty方法的典型用法代码示例。如果您正苦于以下问题:C# FdoConnection.GetConnectTimeProperty方法的具体用法?C# FdoConnection.GetConnectTimeProperty怎么用?C# FdoConnection.GetConnectTimeProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FdoToolbox.Core.Feature.FdoConnection
的用法示例。
在下文中一共展示了FdoConnection.GetConnectTimeProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Connect
public bool Connect()
{
if (string.IsNullOrEmpty(_view.ConnectionName))
{
_view.FlagNameError("Required");
return false;
}
FdoConnection conn = _manager.GetConnection(_view.ConnectionName);
if (conn != null)
{
_view.FlagNameError("A connection named " + _view.ConnectionName + " already exists");
return false;
}
FdoProviderInfo provider = _view.SelectedProvider;
//string connStr = ExpressUtility.ConvertFromNameValueCollection(_view.ConnectProperties);
NameValueCollection cp = new NameValueCollection(_view.ConnectProperties);
if (_pendingProperties.Count > 0)
{
NameValueCollection extra = new NameValueCollection();
cp.Add(extra);
}
string connStr = ExpressUtility.ConvertFromNameValueCollection(cp);
conn = new FdoConnection(provider.Name, connStr);
if (FileService.FileExists(_view.ConfigFile))
{
try
{
conn.SetConfiguration(_view.ConfigFile);
}
catch (Exception ex)
{
conn.Dispose();
_view.FlagConfigError(ex.Message);
return false;
}
}
try
{
FdoConnectionState state = conn.Open();
if (state == FdoConnectionState.Open)
{
_manager.AddConnection(_view.ConnectionName, conn);
return true;
}
else if (state == FdoConnectionState.Pending)
{
//Re-query the pending parameters and re-prompt in a new dialog
if (_pendingProperties.Count > 0)
{
List<DictionaryProperty> pend = new List<DictionaryProperty>();
foreach (DictionaryProperty p in _pendingProperties)
{
pend.Add(conn.GetConnectTimeProperty(p.Name));
}
NameValueCollection extra = PendingParameterDialog.GetExtraParameters(pend);
//Cancelled action
if (extra == null)
return false;
cp.Add(extra);
conn.ConnectionString = ExpressUtility.ConvertFromNameValueCollection(cp);
if (conn.Open() == FdoConnectionState.Open)
{
_manager.AddConnection(_view.ConnectionName, conn);
return true;
}
}
}
else
{
return false;
}
}
catch (Exception ex)
{
_view.ShowError(ex);
conn.Dispose();
return false;
}
return false;
}