SDAC And .Net

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Alexander_73
Posts: 52
Joined: Mon 24 Mar 2008 13:22

SDAC And .Net

Post by Alexander_73 » Tue 13 Apr 2010 11:30

I have replaced in old dll-program ADODB by SDAC. Its working with TMSConnection, TMSQuery components. Uses Devart.SDAC.MSAccess, Devart.SDAC.OleDBAccess, Devart.DAC.DBAccess, Devart.Dac.Memdata and DB.
The library has not compiled for now, issuing an error "File not found: System.Drawing.Imaging.dcuil".

Returning to back on TADOQuery the problem disappears.

SDAC 4.80.57, RAD Studio 2007 Delphi .Net.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 13 Apr 2010 12:54

I can not reproduce the problem.
Please try to compose a small sample to demonstrate the problem and send it to dmitryg*devart*com.

Alexander_73
Posts: 52
Joined: Mon 24 Mar 2008 13:22

Post by Alexander_73 » Tue 13 Apr 2010 13:54

Oh, sample is small:

Code: Select all

{$A-,B-,C+,D-,E-,F-,G+,H+,I+,J+,K-,L-,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y-,Z1}
{$MINSTACKSIZE $00001000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE GUI}
{$WARN SYMBOL_DEPRECATED ON}
{$WARN SYMBOL_LIBRARY ON}
{$WARN SYMBOL_PLATFORM ON}
{$WARN SYMBOL_EXPERIMENTAL ON}
{$WARN UNIT_LIBRARY ON}
{$WARN UNIT_PLATFORM ON}
{$WARN UNIT_DEPRECATED ON}
{$WARN UNIT_EXPERIMENTAL ON}
{$WARN HRESULT_COMPAT ON}
{$WARN HIDING_MEMBER ON}
{$WARN HIDDEN_VIRTUAL ON}
{$WARN GARBAGE ON}
{$WARN BOUNDS_ERROR ON}
{$WARN ZERO_NIL_COMPAT ON}
{$WARN STRING_CONST_TRUNCED ON}
{$WARN FOR_LOOP_VAR_VARPAR ON}
{$WARN TYPED_CONST_VARPAR ON}
{$WARN ASG_TO_TYPED_CONST ON}
{$WARN CASE_LABEL_RANGE ON}
{$WARN FOR_VARIABLE ON}
{$WARN CONSTRUCTING_ABSTRACT ON}
{$WARN COMPARISON_FALSE ON}
{$WARN COMPARISON_TRUE ON}
{$WARN COMPARING_SIGNED_UNSIGNED ON}
{$WARN COMBINING_SIGNED_UNSIGNED ON}
{$WARN UNSUPPORTED_CONSTRUCT ON}
{$WARN FILE_OPEN ON}
{$WARN FILE_OPEN_UNITSRC ON}
{$WARN BAD_GLOBAL_SYMBOL ON}
{$WARN DUPLICATE_CTOR_DTOR ON}
{$WARN INVALID_DIRECTIVE ON}
{$WARN PACKAGE_NO_LINK ON}
{$WARN PACKAGED_THREADVAR ON}
{$WARN IMPLICIT_IMPORT ON}
{$WARN HPPEMIT_IGNORED ON}
{$WARN NO_RETVAL ON}
{$WARN USE_BEFORE_DEF ON}
{$WARN FOR_LOOP_VAR_UNDEF ON}
{$WARN UNIT_NAME_MISMATCH ON}
{$WARN NO_CFG_FILE_FOUND ON}
{$WARN IMPLICIT_VARIANTS ON}
{$WARN UNICODE_TO_LOCALE ON}
{$WARN LOCALE_TO_UNICODE ON}
{$WARN IMAGEBASE_MULTIPLE ON}
{$WARN SUSPICIOUS_TYPECAST ON}
{$WARN PRIVATE_PROPACCESSOR ON}
{$WARN UNSAFE_TYPE ON}
{$WARN UNSAFE_CODE ON}
{$WARN UNSAFE_CAST ON}
{$WARN OPTION_TRUNCATED ON}
{$WARN WIDECHAR_REDUCED ON}
{$WARN DUPLICATES_IGNORED ON}
{$WARN UNIT_INIT_SEQ ON}
{$WARN LOCAL_PINVOKE ON}
{$WARN MESSAGE_DIRECTIVE ON}
{$WARN TYPEINFO_IMPLICITLY_ADDED ON}
{$WARN XML_WHITESPACE_NOT_ALLOWED ON}
{$WARN XML_UNKNOWN_ENTITY ON}
{$WARN XML_INVALID_NAME_START ON}
{$WARN XML_INVALID_NAME ON}
{$WARN XML_EXPECTED_CHARACTER ON}
{$WARN XML_CREF_NO_RESOLVE ON}
{$WARN XML_NO_PARM ON}
{$WARN XML_NO_MATCHING_PARM ON}
library Library1;


uses
  SysUtils,
  Classes,
  System.Reflection,
  Devart.SDAC.MSAccess,
  System.Runtime.InteropServices;

[assembly: AssemblyTitle('')]
[assembly: AssemblyDescription('')]
[assembly: AssemblyConfiguration('')]
[assembly: AssemblyCompany('')]
[assembly: AssemblyProduct('')]
[assembly: AssemblyCopyright('')]
[assembly: AssemblyTrademark('')]
[assembly: AssemblyCulture('')]
[assembly: AssemblyVersion('1.0.*')]
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile('')]
[assembly: AssemblyKeyName('')]
[assembly: ComVisible(False)]

type
  TDistancer = class
  end;

begin
end.
it is all. I uncomment "Devart.SDAC.MSAccess" and I have a compiler error "File not found...".

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 14 Apr 2010 07:57

To solve the problem you should add the System.Drawing.dll library to the project references.

Alexander_73
Posts: 52
Joined: Mon 24 Mar 2008 13:22

Post by Alexander_73 » Wed 14 Apr 2010 10:11

Thanks.

Alexander_73
Posts: 52
Joined: Mon 24 Mar 2008 13:22

Post by Alexander_73 » Thu 22 Apr 2010 11:43

Dimon wrote:To solve the problem you should add the System.Drawing.dll library to the project references.
Uh, there is a new trouble with this sdac & .Net dll. If dll is builded for any cpu or x64 for Windows 2008 Server x64 (for x86 on x86 platform works correctly), host wich uses dll gets exceptions:

Code: Select all

[OverflowException: Arithmetic operation resulted in an overflow.]
   Devart.Sdac.Units.OLEDBAccess.@851OLEDBAccess$InitDataSourceTypes$AddType($Unnamed113& $frame_InitDataSourceTypes, String TypeName) +365
   Devart.Sdac.Units.OLEDBAccess.InitDataSourceTypes() +233
   Devart.Sdac.Units.OLEDBAccess.Devart.Sdac.OLEDBAccess() +45

[TypeInitializationException: The type initializer for 'Devart.Sdac.Units.OLEDBAccess' threw an exception.]
   System.Runtime.CompilerServices.RuntimeHelpers._RunClassConstructor(IntPtr type) +0
   System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(RuntimeTypeHandle type) +22
   Devart.Sdac.Units.MSAccess..cctor() +161

[TypeInitializationException: The type initializer for 'Devart.Sdac.Units.MSAccess' threw an exception.]
   System.Runtime.CompilerServices.RuntimeHelpers._RunClassConstructor(IntPtr type) +0
   System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(RuntimeTypeHandle type) +22
:shock:

In sample test added constructor with

Code: Select all

  Connection:=TMSConnection.Create(nil);
  Connection.ConnectString:=aConnStr;
  Connection.KeepConnection:=false;
  Connection.LoginPrompt:=false;
  Connection.ConnectionTimeout:=600;
  Connection.Options.KeepDesignConnected:=false;
  Connection.Options.MultipleActiveResultSets:=true;
  Connection.Options.DefaultSortType:=stCaseInsensitive;
  Connection.Options.PacketSize:=8192;
  Connection.Options.DefaultLockTimeout:=30000;
  MSQuery:=TMSQuery.Create(nil);
  MSQuery.Connection:=Connection;
  MSQuery.SQL.Text:='SELECT * FROM TestTable';
  MSQuery.Open -- this string raises exception 'arythmetic overflow...'

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 23 Apr 2010 14:07

I could not reproduce the problem.
Please compose a sample to demonstrate the problem and send it to dmitryg*devart*com.

Alexander_73
Posts: 52
Joined: Mon 24 Mar 2008 13:22

Post by Alexander_73 » Mon 26 Apr 2010 10:53

I have sent 3 files: dpr, exe & exe.config

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Tue 27 Apr 2010 09:34

We have answered you by e-mail.

hsldev
Posts: 8
Joined: Fri 16 Mar 2007 03:20

Post by hsldev » Tue 15 Mar 2011 00:14

Hi there,

We are having the same problem above running a .NET app on windows server 2008r2 (64-bit) and was happy to see this post, but then sad to see there was no resolution on here!

I presume you were able to solve the issue and advised this person by email, but could you post the resolution as well for others who then have the same problem?

Regards,

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 28 Mar 2011 08:39

The point is that RAD Studio compiles only 32-bit dll, and you cannot use it in the 64-bit application. 32-bit apllications work in 64-bit operating system in 32-bit mode.

Post Reply