Re: 'System.TypeLoadException' occured when calling Database access from a DLL that is referenced from PPC

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 05/19/04


Date: Wed, 19 May 2004 18:46:09 +0100

Callon Campbell <campbelc@norbord.com> wrote:
> What I'm doing is this. I have a PPC app in C# (VS.NET 2003) that
> communicates to a SQL Server 2000 database server. I'm using direct
> connection via the System.Data.SqlClient namespace. So I created a
> Connection and Data class which connects to the DB and performs a
> vary of SQL calls, mostly calling stored procs.
>
> At first these two classes where part of my PPC app (exe) and worked
> just great. I then needed to move these two classes out into their
> own assembly, with a diff namespace so that two distinct PPC and CE
> apps could leverage them.
>
> When I did this, I got an error message when calling ANY function
> from these classes that talks to the database. The error Message was:
>
> "An unhandled exception of type 'System.TypeLoadException' occured in
> System.Windows.Forms.Dll
>
> Additional information: Could not load type
> System.Data.SqlClient.SqlConnection from assembly System.Data,
> Version=1.0.5000.0, Culture=neutral,
> PublicKeyToken=B77A5C561934E089"
>
> Any help would be greatly appreciated. Can I not put my common
> dataaccess routines in their own assembly and have other EXE or DLL's
> reference them? If so what am I missing. If not then please let me
> know.

Yes you can. However, you need to make sure that your library assembly
is copied to the appropriate place (usually the same directory as the
executable). Have you checked on the device (or emulator) to make sure
that the executable and the library are in the same place?

-- 
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Relevant Pages

  • VB connection to SQL server
    ... I have an application using VB 6 and SQL server 2000. ... The Database server is in the office, and people use the Vb program from ... workstation in the office, in otherwords it's running in a LAN. ... the connection from my VB program to SQL server need to go through ...
    (microsoft.public.vb.database)
  • Re: Error setting up new server to run asp.net
    ... Your server is trying to locate the database server, ... An error has occurred while establishing a connection to the server. ... under the default settings SQL Server does not allow remote connections. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Unable to reconnect to SQL Server after the server is restarted
    ... The Database Server and the application are running on seperate physical machines. ... I receive the error message "SQL Server is unavailable or access is denied". ... I am using connection pooling with the default connection pool size. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Error "SQL Server does not allow remote connections"
    ... The application could not connect to the sql server db. ... network is blocking the connection. ... SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 ... integratedSecurity, SqlConnection owningObject) +737554 ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Connection from remote computer to network SQL Server
    ... There is no firewall on the W2K machine acting as the SQL server. ... I tried making the SQL machine a "trusted" on the router. ... connection works. ... To find the IP address of your computer inside the network, ...
    (microsoft.public.access.adp.sqlserver)