Re: Reflection and SqlConnection

Discussion in 'ASP .Net' started by WebDevHokie, Jul 10, 2003.

  1. WebDevHokie

    WebDevHokie Guest

    I just found some interesting information. I tried running this same code
    on a co-workers computer and it works fine. The only difference between us
    is that I have both the 1.0 and 1.1 frameworks on my box. The other
    gentleman has only the 1.0 framework. Would this cause a problem?

    I set all my mappings to use the 1.0.3705 framework.

    Thanks

    WebDevHokie

    "WebDevHokie" <> wrote in message
    news:%23$pE%...
    > I am using reflection to create a data access component. I have the
    > following code:
    >
    > SqlConnection o_Temp = new SqlConnection();
    > System.Data.IDbConnection o_Connection;
    > o_Connection = o_Temp as IDbConnection;
    >
    > This works correctly but it does not use reflection. Now I am looking to
    > use this code:
    >
    >
    > System.Reflection.Assembly o_Assembly =
    > System.Reflection.Assembly.LoadWithPartialName("System.Data");
    > object o_Temp2 =
    > o_Assembly.CreateInstance("System.Data.SqlClient.SqlConnection");
    > System.Data.IDbConnection o_Connection;
    > o_Connection = o_Temp2 as IDbConnection;
    >
    > This does not work as o_Connection is null when it attempts to cast. Any
    > idea why this would be?
    >
    > Thanks in advance!
    >
    >
     
    WebDevHokie, Jul 10, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark

    Can't open a SqlConnection

    Mark, May 9, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    760
  2. Nick
    Replies:
    0
    Views:
    436
  3. WebDevHokie

    Re: Reflection and SqlConnection

    WebDevHokie, Jul 10, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    452
    WebDevHokie
    Jul 10, 2003
  4. William F. Robertson, Jr.

    Re: vbc cant find system.data.sqlClient.sqlConnection

    William F. Robertson, Jr., Jul 28, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    676
    William F. Robertson, Jr.
    Jul 28, 2003
  5. William \(Bill\) Vaughn

    Re: SqlConnection and connection pooling

    William \(Bill\) Vaughn, Nov 14, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    506
    William \(Bill\) Vaughn
    Nov 14, 2003
Loading...

Share This Page