Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 11-10-2005, 08:23 PM
DarkAngel DarkAngel is offline
Senior Member
 
Join Date: Sep 2002
Posts: 292
Default Create an instance for a class

This is my codes:
type

Tmycls=class

cnn:Tadoconnection;

public

constructor Create()

var

strcnn:string;

begin

cnn.create(acomponent);

strcnn='connection string';

cnn.connectstring:=strcnn;

cnn.open();

end;

end;

////////////////////this is how to call

objmycls:Tmycls;

objmycls.create();//An error comes up at cnn.connectstring:=strcnn; reading system reserved area in the memory.

Pls help check what's wrong and how to fix it.

Thanks a bunch.

DarkAngel
^-^
Reply With Quote
  #2  
Old 11-10-2005, 10:49 PM
Rat Rat is offline
Member
 
Join Date: Jun 2002
Posts: 97
Default RE: Create an instance for a class

shouldn't it be :

objmycls := Tmycls.create ;
Reply With Quote
  #3  
Old 11-11-2005, 03:46 AM
mshkolnik mshkolnik is offline
Senior Member
 
Join Date: Jul 2001
Posts: 4,195
Default RE: Create an instance for a class

Instead
cnn.create(acomponent);
use
cnn := Tadoconnection.create(acomponent);


With best regards, Mike Shkolnik
http://www.scalabium.com
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 12:28 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.