Click here to Skip to main content
15,886,788 members
Home / Discussions / Database
   

Database

 
GeneralRe: check database exists Pin
Jeff Varszegi27-Apr-04 7:51
professionalJeff Varszegi27-Apr-04 7:51 
GeneralRe: check database exists Pin
Jeff Martin28-Apr-04 5:35
Jeff Martin28-Apr-04 5:35 
GeneralRe: check database exists Pin
Jeff Varszegi28-Apr-04 7:08
professionalJeff Varszegi28-Apr-04 7:08 
GeneralRe: check database exists Pin
Jeff Martin29-Apr-04 9:02
Jeff Martin29-Apr-04 9:02 
GeneralRe: check database exists Pin
Jeff Varszegi29-Apr-04 9:38
professionalJeff Varszegi29-Apr-04 9:38 
GeneralInstalling ole db provider for microsoft project without installing microsoft project Pin
vinay_mat26-Apr-04 20:39
vinay_mat26-Apr-04 20:39 
GeneralLinked server from SQL Server 2000 to Sybase 12 Pin
Janya26-Apr-04 14:30
Janya26-Apr-04 14:30 
QuestionHow to create linked tables using ADOX? Pin
Santanu Lahiri26-Apr-04 12:06
Santanu Lahiri26-Apr-04 12:06 
I need to create a series of linked tables in an Access database using ADOX.
I have the ADOX files from C. Antollini's article.
I tried the following code, everything seems to work okay until the actual append call.

// cat is a catalog defined as per ADOX.h
// ConnectString is "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;Persist Security Info=False"

CString sTbl = dlgLst.m_sTable;

CString sConnectSrc, sConnectTrg;
sConnectSrc.Format (ID_ADO_CONNECTSTR, m_sDBFile);
sConnectTrg.Format (ID_ADO_CONNECTSTR, sDBFile);
LPCTSTR lpTblName = sTbl;
LPCTSTR lpConnectSrc = sConnectSrc;
LPCTSTR lpConnectTrg = sConnectTrg;

CADOXCatalog cat;
cat.Open (sConnectSrc); // this is the Database in which the table definision is to be created

_TablePtr tbl;
tbl.CreateInstance(__uuidof(Table)); // Create the instance of a table
tbl->PutName (lpTblName); // give it a local name
tbl->put_ParentCatalog(cat.m_pCatalog); // define the parent catalog

// some debugging info, could also use TRACE
AfxMessageBox (sConnectTrg);
AfxMessageBox (sConnectSrc);

tbl->Properties->GetItem(_T("Jet OLEDB:Create Link"))->Value = true; // make it a linked table
tbl->Properties->GetItem(_T("Jet OLEDB:Link Datasource"))->Value = lpConnectTrg;
tbl->Properties->GetItem(_T("Jet OLEDB:Remote Table Name"))->Value = lpTblName;

// Upto this point everything executes. At least, I do not get any complaints

try
{
cat.m_pCatalog->Tables->Append (_variant_t((IDispatch *)tbl));
cat.m_pCatalog->Tables->Refresh();
}
catch(_com_error &e)
{
TCHAR szBuf[300];
// Notify the user of errors if any.
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
sprintf(szBuf, "\n\tSource : %s \n\tDescription : %s \n ", (LPCSTR)bstrSource,(LPCSTR)bstrDescription);
CString sErr = CString (szBuf);
AfxMessageBox (sErr);
}


This is causing an error saying "Not a Valid File Name" from the JET engine. The two file names are correct, and the files are both valid databases. Also, the table to be linked exists in the database being linked to.

I am using VC6 and MDAC 2.8.

Any pointers would be most welcome.
AnswerFollowup: How to create linked tables using ADOX? Pin
Santanu Lahiri29-Apr-04 10:13
Santanu Lahiri29-Apr-04 10:13 
GeneralRestore database Pin
tmcafee26-Apr-04 8:40
tmcafee26-Apr-04 8:40 
GeneralRe: Restore database Pin
Mazdak26-Apr-04 20:52
Mazdak26-Apr-04 20:52 
GeneralImport Oracle *.DMP into MS-SQL (without Oracle DB Server) Pin
johncogan26-Apr-04 3:45
johncogan26-Apr-04 3:45 
GeneralRe: Import Oracle *.DMP into MS-SQL (without Oracle DB Server) Pin
RichardGrimmer26-Apr-04 3:56
RichardGrimmer26-Apr-04 3:56 
GeneralRe: Import Oracle *.DMP into MS-SQL (without Oracle DB Server) Pin
Steve S28-Apr-04 1:31
Steve S28-Apr-04 1:31 
GeneralSimple Insert Statement Pin
dabuskol25-Apr-04 23:09
dabuskol25-Apr-04 23:09 
GeneralRe: Simple Insert Statement Pin
Peet Schultz26-Apr-04 3:19
Peet Schultz26-Apr-04 3:19 
GeneralRe: Simple Insert Statement Pin
Janya26-Apr-04 14:34
Janya26-Apr-04 14:34 
GeneralEncrypted Tables From ASP.NET & Access Pin
MKlucher24-Apr-04 14:42
MKlucher24-Apr-04 14:42 
GeneralData Grid / update when going to next record Pin
xstoneheartx23-Apr-04 13:24
xstoneheartx23-Apr-04 13:24 
GeneralDatagrid Multi-table update Pin
Anonymous23-Apr-04 7:03
Anonymous23-Apr-04 7:03 
GeneralMinimum of 2 values Pin
Colin Angus Mackay22-Apr-04 12:05
Colin Angus Mackay22-Apr-04 12:05 
GeneralRe: Minimum of 2 values Pin
Mike Ellison23-Apr-04 5:46
Mike Ellison23-Apr-04 5:46 
GeneralRe: Minimum of 2 values Pin
Colin Angus Mackay23-Apr-04 5:54
Colin Angus Mackay23-Apr-04 5:54 
GeneralRe: Minimum of 2 values Pin
Mike Ellison23-Apr-04 5:54
Mike Ellison23-Apr-04 5:54 
GeneralRe: Minimum of 2 values Pin
Peet Schultz26-Apr-04 3:41
Peet Schultz26-Apr-04 3:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.