Colin - one quick way to get the responsive UI is to use an Async delegate.
If you're using the 2.0 framework you may be able to use MARS to accomplish
some of what you want to. Right off the bat I don't see anything wrong with
the code, I'm not on my dev machine so I'll take a look at it when I get
back home. I have a quick example of using async delegates here
http://www.knowdotnet.com/articles/reponsiveui.html
Two things though you might want to be aware of... 1) The close doesn't
appear to be in a finally block so may not execute. Connections aren't
thread safe btw either but that's not the problem - I just mention it as a
FYI. But if an exception is throw, the connection will stay open and that
can cause a problems - (as a sample, intentionally throw an exception in
your execution after opening a connection putting it in a loop, it won't be
long before you experience major drama).
2- Believe it or not, hackers can actually launch a pretty destructive
injection attack by virtue of a connection string. For instance, if they
used blahblahblah; trusted_connection = true, you'll actually end up using
the trust instead of the other account which depending on your security
configuration, may allow them to connect without knowing the password. They
can also specify a minimum and maximum pool size of 1 billion for instance
that can cause some real mischief. Main point, if you're allowing user
input for the connection string, you may want to reconsider. In the 2.0
framework there's a ConnectionStringBuilder object that you want to use for
the same reason you want to use paramaterized queries instead of
concatenated strings - Microsoft knows better than anyone what all can be
done with connection strings and they've built the ConnectionStringBuilder
with all that knowledge - not only is it safer, it's easier to use. However
this isn't the problem you're facing, again I mention it simply as a FYI.
I'll get back to you shortly when I get home and see if we can't solve your
problem.
Cheers,
Bill
> Appologies for cross posting this but languages.vb may not be the correct
> place to have asked in hindsight.
[quoted text clipped - 266 lines]
>
> End Function
Colin Robinson - 15 Jan 2006 09:30 GMT
Thanks.
I am aware of the injection stuff this code is running internally on a
10.10.xx.xx ip address so should be reasonably safe in that respect.
The connection strings may benefit from the connectionstring object now I
know the driver for it is. is there a new wizard front end for creating
them.
given the code will allow tsql like "drop database" Injection attacks and
security is not a concen its a quick tool for our dbas im creating.
All comments are welcome, the app will be better for it.
Thanks again
Colin
> Colin - one quick way to get the responsive UI is to use an Async
> delegate. If you're using the 2.0 framework you may be able to use MARS to
[quoted text clipped - 302 lines]
>>
>> End Function
Kevin Yu [MSFT] - 16 Jan 2006 02:32 GMT
Hi Colin,
To get a wizard for building connection strings, you can use the OLE DB
Data Link Properties dialog box. However, it's not designed for .NET, you
have to make some changes to the connection string after getting it. It's a
COM object and you can check the following KB article for how to use it.
http://support.microsoft.com/default.aspx?scid=kb;en-us;286189
Kevin Yu

Signature
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."