Article View: borland.public.cppbuilder.database.ado
Article #4930Invalid pointer operation
From: Zero
Date: Sat, 01 Sep 2001 04:55
Date: Sat, 01 Sep 2001 04:55
74 lines
2887 bytes
2887 bytes
I am trying to make a DLL to use ADO I created some functions in this DLL,
am having problems in two of them the first one that it returns the Fields
(TFields *) and another one the Field (TField *), but when I arrive at the
end of one for it gives to an error invalid to pointer operation.
Some idea?
Code:
First Form -->
void fnGetFields(TObject* objData,TFields& Fields)
{
try {
Fields = ((TADODataSet*)objData)->Fields;
} catch (...) {
}
}
void fnGetField(TObject* objData,char* cField,TField& Field)
{
try {
Field = ((TADODataSet*)objData)->FieldByName(cField);
} catch (...) {
}
}
For:
// tb is Private Object
// ls is ListBox
TFields fFields;
TField fField;
String strData,strName;
fnGetFields(tb,fFields);
for (int i = 0;i < fFields->Count;i++) {
strName = fFields->Fields[i]->DisplayName;
fnGetField(tb,strName.c_str(),fField);
strData = fField->AsString;
ls->Lines->Add(strName + " " + strData);
} // Error: Invalid pointer operation
Second Form -->
TFields* fnGetFields(TObject* objData)
{
TFields* fFields;
try {
fFields = ((TADODataSet*)objData)->Fields;
} catch (...) {
}
return(fFields);
}
TField* fnGetField(TObject* objData,char* cField)
{
TField* fField;
try {
fField = ((TADODataSet*)objData)->FieldByName(cField);
} catch (...) {
}
return(fField);
}
For:
// tb is Private Object
// ls is ListBox
TFields fFields;
TField fField;
String strData,strName;
fFields = fnGetFields(tb);
for (int i = 0;i < fFields->Count;i++) {
strName = fFields->Fields[i]->DisplayName;
fField = fnGetField(tb,strName.c_str());
strData = fField->AsString;
ls->Lines->Add(strName + " " + strData);
} // Error: Invalid pointer operation
Technical Details
Message-ID:
<3b906bcc_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!194.25.134.62!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f5ca7,99a1a2e4cbb50d24,start X-Google-Attributes: gidf5ca7,public X-Google-Thread: 103c8d,99a1a2e4cbb50d24,start X-Google-Attributes: gid103c8d,public X-Google-Thread: 10698b,99a1a2e4cbb50d24,start X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2001-08-31 22:08:28 PST From: <Zero> Newsgroups: borland.public.cppbuilder.database.ado,borland.public.cppbuilder.language,borland.public.cppbuilder.winapi Subject: Invalid pointer operation Date: Sat, 1 Sep 2001 01:55:37 -0300 Lines: 76 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: 200.204.62.133 Message-ID: <3b906bcc_2@dnews> X-Trace: dnews 999320524 200.204.62.133 (31 Aug 2001 22:02:04 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!194.25.134.62!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews