Article View: borland.public.cppbuilder.database.ado
Article #1871Re: Linking Tables to an MSAccess Database in Code
From: Robert Emmons
Date: Mon, 26 Jan 2004 15:48
Date: Mon, 26 Jan 2004 15:48
46 lines
2616 bytes
2616 bytes
Now all the code compiles and runs without error messages. However,
it does not create a table in HitTemp.mdb linked to the "LinkTest"
table in HitData.mdb. I suspect the problem is with the
cat->Append(Variant) statement. I don't know what to use as the
"Variant" or "tagVARIANT" argument.
As usual, I would appreciate any help. Here is the code:
AnsiString thisDb = "C:\\data\\HitTemp.mdb";
AnsiString thisTbl = "HitDataLinkTest";
AnsiString thatDb = "C:\\data\\HitData.mdb";
AnsiString thatTbl = "LinkTest";
Variant thisDbConnectStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" + thisDb;
Adox_tlb::TCOM_Catalog cat = CoCatalog::Create();
// cat->Create(WideString(thisDbConnectStr));
cat->set_ActiveConnection(thisDbConnectStr);
Adox_tlb::TCOM_Table tbl = CoTable::Create();
tbl->ParentCatalog = cat;
Adox_tlb::Property *ppvObject;
Variant ppvName;
Variant ppvValue;
ppvName = "Jet OLEDB:Create Link";
ppvValue = true;
ppvObject = tbl->Properties->get_Item(ppvName);
ppvObject->set_Value(ppvValue);
ppvName = "Jet OLEDB:Link Datasource";
ppvValue = thatDb;
ppvObject = tbl->Properties->get_Item(ppvName);
ppvObject->set_Value(ppvValue);
ppvName = "Jet OLEDB:Remote Table Name";
ppvValue = thatTbl;
ppvObject = tbl->Properties->get_Item(ppvName);
ppvObject->set_Value(ppvValue);
cat->Tables->Append(Variant(thisTbl));
Technical Details
Message-ID:
<vkda10dt31enmokkrfrgmipag5du0igvs4@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<pu5t00drncdrn41hnftvesb6nviv7pjs4l@4ax.com> <400fcfe1@newsgroups.borland.com> <8ek510h1jdvdgubdq1gevn5kn0ka595vef@4ax.com> <4013952a@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,624e139e318cdbfb X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2004-01-26 08:10:31 PST From: Robert Emmons <remmons@aurigen.com> Newsgroups: borland.public.cppbuilder.database.ado Subject: Re: Linking Tables to an MSAccess Database in Code Date: Mon, 26 Jan 2004 10:48:40 -0500 Message-ID: <vkda10dt31enmokkrfrgmipag5du0igvs4@4ax.com> References: <pu5t00drncdrn41hnftvesb6nviv7pjs4l@4ax.com> <400fcfe1@newsgroups.borland.com> <8ek510h1jdvdgubdq1gevn5kn0ka595vef@4ax.com> <4013952a@newsgroups.borland.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 68.193.14.50 X-Trace: newsgroups.borland.com 1075131996 68.193.14.50 (26 Jan 2004 07:46:36 -0700) Lines: 48 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail