views:

324

answers:

2

Hello,

I've been writing some small maintenance/viewer tools that each connect to a SQLServer (2005) database via System.Data.SqlClient classes. (C# - .NET 3.5 - Windows.Forms)

For each of these tools I had to write the UI and dialog to let the user choose the right db and server: I connect to my test-db, my colleague uses my tools too and connects his test-db.

I'm looking for a plugable usercontrol that lets the user select a server, db and the rest of the connection parameters and that provides a SqlClient.SqlConnection to the rest of the application.

I've tried writing a usercontrol myself now, but I'm sure there must be others ,better ones and better tested ones. I've been Googling and looking at CodeProject, but found none.

Thanks!

Jan

+1  A: 

What you're describing here is simple enough that I doubt there's something out there that does only this. You'd probably be better off sticking with your own code here.

MusiGenesis
Agreed, this seems fairly straightforward to write.
tbreffni
+2  A: 

There must be some better than one I wrote recently, because that one's so bad:

Just

  1. Create a user control
  2. drag a couple of bottons to it, anchor bottom center, make them ok and cancel
  3. drag a Property Grid control onto it, dock fill
  4. Add a read-only property to the control of type SqlConnectionStringBuilder, back it with a field
  5. Initialize the field to a new SqlConnectionStringBuilder instance
  6. In the Load event, set the Object property of the property grid to the SqlConnectionStringBuilder

That's pretty much that. The user just gets to fill in the properties. If you like, you can also create a ConnectionString property on the control and have it return the .ConnectionString property of the SqlConnectionStringBuilder.

John Saunders
Thanks for pointing me to the Property Grid Control. My solution wil do for now.
jan