Ahmed Hashish
2007-09-23 09:07:02 UTC
Dear Sir
I'd like to create a user control that has a connection string property that allows the user to setup a connection at design time in the same fashion as in Project settings or TableAdapters.
When a someone adds this control to their form, there will be a property called ConnectionString that when it is clicked (via the Properties grid), it will bring up the Connection Properties dialog box.
I tried the following code:
namespace UserControls
{
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
private string _connectionstring;
[RefreshProperties(RefreshProperties.All), RecommendedAsConfigurable(true), DefaultValue(""), Editor("Microsoft.VSDesigner.Data.SQL.Design.SqlConnectionStringEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string Connectionstring
{
get { return _connectionstring; }
set { _connectionstring = value; }
}
}
}
but the Editor used allow to build SQL connections only, Is there other Editors help building other databases connections.
Ahmed Hashish
I'd like to create a user control that has a connection string property that allows the user to setup a connection at design time in the same fashion as in Project settings or TableAdapters.
When a someone adds this control to their form, there will be a property called ConnectionString that when it is clicked (via the Properties grid), it will bring up the Connection Properties dialog box.
I tried the following code:
namespace UserControls
{
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}
private string _connectionstring;
[RefreshProperties(RefreshProperties.All), RecommendedAsConfigurable(true), DefaultValue(""), Editor("Microsoft.VSDesigner.Data.SQL.Design.SqlConnectionStringEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public string Connectionstring
{
get { return _connectionstring; }
set { _connectionstring = value; }
}
}
}
but the Editor used allow to build SQL connections only, Is there other Editors help building other databases connections.
Ahmed Hashish