On 01/26/04 Jaroslaw Kowalski wrote:
> For MSSQL I do (watch for line breaks):
> 
> Type t = Type.GetType("System.Data.SqlClient.SqlConnection, System.Data,
> Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")
> 
> IDbConnection conn = (IDbConnection)Activator.CreateInstance(t);
> 
> Note, that Type.GetType() needs:
> 
> 1. Local assembly name when the assembly is in application directory.
> 2. Fully qualified assembly name when the assembly is in the GAC or you want
> to take specific advantage of the assembly binding redirection.
> 
> To get the fully qualified assembly name from GAC it's best to use: "gacutil
> /l"

I think it's way better to use something like:
        Assembly a = Assembly.LoadWithPartialName ("System.Data");
        Type t = a.GetType ("System.Data.SqlClient.SqlConnection");
        ...
because I guess your code is going to break with the next (or different
versions) of the CLR where the exact same version may not be available.

lupus

-- 
-----------------------------------------------------------------
[EMAIL PROTECTED]                                     debian/rules
[EMAIL PROTECTED]                             Monkeys do it better
_______________________________________________
Mono-list maillist  -  [EMAIL PROTECTED]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to