UniConnection Variable Cannot Be Declared Successfully

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for universal data access
Locked
lgojer01

UniConnection Variable Cannot Be Declared Successfully

Post by lgojer01 » Tue 15 Mar 2005 19:43

{Please ignore all lines that are commented out that have to do
with Oracle, because this is going to become an ADO program.
I am trying to convert it from one Corelab format to another.
The line of code that has the UniConnection Variable does not
compile, saying that there is no such class. Could you please tell
me how to successfully invoke the UniConnection Class?
Thank You,
Leonard Gojer }
program Project1;

{%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.dll'}
{%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Data.dll'}
{%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Drawing.dll'}
{%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Windows.Forms.dll'}
{%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.XML.dll'}

uses
System.Reflection,
System.Runtime.CompilerServices,
Db,
Messages,
SysUtils,
Classes,
Controls;

{System.Windows.Forms,
WinForm1 in 'WinForm1.pas' !WinForm1.TWinForm1: System.Windows.Forms.Form!;}

{$R *.res}

var
flag : boolean;
k : integer;
Connection1 : UniConnection; { This line of Code does not compile, can't link to CoreLab Module }
{OraSession1 : TOraSession;}
key1 : string;
key2 : string;
data1 : string;
{test1 : TOraTable;}
{tmem1 : TMemDataSet;}
flag2 : boolean;
blank : string;
{$REGION 'Program/Assembly Information'}
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyDescription('')]
[assembly: AssemblyConfiguration('')]
[assembly: AssemblyCompany('')]
[assembly: AssemblyProduct('')]
[assembly: AssemblyCopyright('')]
[assembly: AssemblyTrademark('')]
[assembly: AssemblyCulture('')]

// The Delphi compiler controls the AssemblyTitleAttribute via the ExeDescription.
// You can set this in the IDE via the Project Options.
// Manually setting the AssemblyTitle attribute below will override the IDE
// setting.
// [assembly: AssemblyTitle('')]


//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:

[assembly: AssemblyVersion('1.0.*')]

//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile('mykey.snk')], provided your output
// directory is the project directory (the default).
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile('')]
[assembly: AssemblyKeyName('')]
{$ENDREGION}

[STAThread]
begin
{Application.Run(TWinForm1.Create);}
flag := false;
{OraSession1 := TOraSession.Create(nil);
OraSession1.Server := 'dbgojer';
OraSession1.Password := 'shlock';
OraSession1.Username := 'SYSTEM';
OraSession1.Connect;
test1 := TOraTable.Create(nil);
test1.TableName := 'TEST1';
test1.Open;
tmem1 := TMemDataSet.Create(nil);
tmem1.Open;}
blank := '';
while not flag do
begin
writeln;
writeln('Menu');
writeln('1 - insert record');
writeln('2 - delete record');
writeln('3 - search record');
writeln('4 - change record');
writeln('5 - list all records');
writeln('6 - quit program');
write('> ');
readln(k);
case k of
1 : begin
write('Enter key: ');
readln(key1);
write('Enter data: ');
readln(data1);
{test1.Insert;
test1.FieldByName('KEY').AsString := key1;
test1.FieldByName('DATA').AsString := data1;
test1.Post;
test1.Close;
test1.Open;}
end;
2 : begin
write('Enter key: ');
readln(key1);
try
{test1.Locate('KEY',key1,[loPartialKey]);
test1.Delete;
test1.Post;
test1.Close;
test1.Open;}
except
end;
end;
3 : begin
write('Enter key: ');
readln(key1);
{test1.Locate('KEY',key1,[loPartialKey]);
data1 := test1.FieldByName('DATA').AsString;}
writeln('Data1: ',data1);
end;
4 : begin
write('Enter key: ');
readln(key1);
write('Enter data: ');
readln(data1);
try
{test1.Locate('KEY',key1,[loPartialKey]);
test1.Delete;
test1.Post;
test1.Close;
test1.Open;}
except
end;
{test1.Insert;
test1.FieldByName('KEY').AsString := key1;
test1.FieldByName('DATA').AsString := data1;
test1.Post;
test1.Close;
test1.Open;}
end;
5 : begin
key1 := '';
{test1.FindFirst;
key2 := test1.FieldByName('KEY').AsString;
data1 := test1.FieldByName('DATA').AsString;
writeln('Key1: ',key2:0,blank:(20 - length(key2)),' Data1: ',Data1);}
flag2 := true;
while flag2 do
begin
{flag2 := test1.FindNext;
key2 := test1.FieldByName('KEY').AsString;
data1 := test1.FieldByName('DATA').AsString;
if flag2 then writeln('Key1: ',key2:0,blank:(20 - length(key2)),' Data1: ',Data1);}
end;
end;
6 : begin
flag := true;
end;
end;
end;
{test1.Close;
OraSession1.Disconnect;}
end.

Oleg
Devart Team
Posts: 264
Joined: Thu 28 Oct 2004 13:56

Post by Oleg » Fri 18 Mar 2005 13:43

Try add this line to your code:
{%DelphiDotNetAssemblyCompiler '$(SystemRoot)\microsoft.net\framework\v1.1.4322\CoreLab.UniDirect.dll'}

lgojer01

Follow up on your suggestion...

Post by lgojer01 » Tue 22 Mar 2005 21:33

I tried what you told me to do, and it took the new line of code,
but the line of code with the UniConnection variable returns the
error "Undeclared Identifier: UniConnection" when it is uncommented.
Is there some other line of code missing, such as in the uses clause?

Oleg
Devart Team
Posts: 264
Joined: Thu 28 Oct 2004 13:56

Post by Oleg » Wed 23 Mar 2005 11:11

You also need to add Corelab.UniDirect to uses section, remove all files Corelab.UniDirect.dcuil
and Corelab.UniDirect.dcpil if they are present.

lgojer01

Additional instruction leads to new error....

Post by lgojer01 » Wed 23 Mar 2005 19:33

I tried putting Corelab.Unidirect into the uses clause, (along with
putting the Corelab.Unidirect.dll file in the appropriate directory),
and I got the following error from the compiler:

"Access violation at address 092D2868 in module dcc71.1.dll
read of address 00000000"

What do you suggest is the next step?....

lgojer01

Strategy for solving bug:

Post by lgojer01 » Mon 04 Apr 2005 16:11

I have decided that since this negotiates the bug into a
weird programming situation, that I am going to do some
reading from a book that hasn't arrived yet before I ask
any more questions about the bug. Thank You very much
for the help that you have given me.
Leonard Gojer

lgojer01

Can Close the Topic

Post by lgojer01 » Tue 19 Apr 2005 13:56

Since it is possible to put an ADO connection (or dataset, rather)
onto a form, and then make the form invisible, then there is no
reason to pursue this avenue of programming. Thank you very
much for trying to help me. You can close the topic.

Leonard Gojer

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Fri 01 Sep 2006 07:09

You are welcome.

Locked