What is this ADOX? Can you create a Table using ADO or must you use ADOX?

What is this ADOX? Can you create a Table using ADO or must you use ADOX?

Post by Jacques Koort » Wed, 13 Feb 2002 19:29:56



Hi,

Im learing to use ADO and not DAO, but there seems to be no help on creating
a table in an existing database using ADO.

I searched the web and found this new thing ADOX. It looks like I need this
to create a table. Why did they not incorporate this adding function to ADO?

any light on this will be appreciated.

thanks in advance
jk

 
 
 

What is this ADOX? Can you create a Table using ADO or must you use ADOX?

Post by Alun Morga » Wed, 13 Feb 2002 22:34:50


Hi Jacques

ADOX is ADO Extension for DataDefinitionLanguage and Security. You can
usethe Catalog object to Create a Database. You can create Tables in a
Database using ADODB. If you are using Access2000 try its help on SQL. You
can find help on CREATE TABLE here. I found information on ADOX at
http://msdn.microsoft.com/library/periodic/period99/msovba_ado.htm its got
some code samples.

Alun

 
 
 

What is this ADOX? Can you create a Table using ADO or must you use ADOX?

Post by Jacques Koort » Wed, 13 Feb 2002 22:49:09


In a nutshell what is ADOX used for?

thanks on help on previous question. I have access xp so i'll look there how
to create Tables.

 
 
 

What is this ADOX? Can you create a Table using ADO or must you use ADOX?

Post by Stev » Thu, 14 Feb 2002 00:39:32


In attempting to "uncomplicate" the ADO interace, they separated out
some of the old DAO functionality into separate modules.  The ADOX
component lets you view and change database structure, and the JRO
component lets you do things like compact a datbase (the J stands for
Jet, so it is also specific to that type of database).  This is one of
the many reasons why some people don't like the ADO system.  Without
starting an argument over which system is "better," I'll just say that
ADO/ADOX/JRO are pretty easy to work once you understand what each one
does.

HTH,
Steve


> Hi,

> Im learing to use ADO and not DAO, but there seems to be no help on creating
> a table in an existing database using ADO.

> I searched the web and found this new thing ADOX. It looks like I need this
> to create a table. Why did they not incorporate this adding function to ADO?

> any light on this will be appreciated.

> thanks in advance
> jk

 
 
 

What is this ADOX? Can you create a Table using ADO or must you use ADOX?

Post by Alun Morga » Thu, 14 Feb 2002 01:35:57


Hi Jacques

I came across this site in vb.database newsgroup http://www.adoanywhere.com

Alun

 
 
 

What is this ADOX? Can you create a Table using ADO or must you use ADOX?

Post by Jacques Koort » Fri, 15 Feb 2002 16:21:49


Thank you for this answer about ADOX. What comes after ADO? Is there
something new out yet?
 
 
 

1. I am creating a new query using ADOX and no matter

I am creating a new query using ADOX and no matter
what I do I cannot see the query in the Database window.
I have even pasted the example from the MSDN and change code.
What am I doing wrong ?

//Maybe:
m_pCatalog->Procedures->Append("MyProcedure", _variant_t((IDispatch
*)m_pCommand));

but no matter.

Command and CommandText Properties Example (VC++)
The following code demonstrates how to use the Command property to
update the text of a procedure.
// BeginCommandTextCpp
#import "c:\Program Files\Common Files\system\ado\msadox.dll" \
no_namespace
#import "c:\Program Files\Common Files\system\ado\msado15.dll"

#include "iostream.h"
#include "stdio.h"
#include "conio.h"

//Function declarations
inline void TESTHR(HRESULT x) {if FAILED(x) _com_issue_error(x);};
void ProcedureTextX(void);

//////////////////////////////////////////////////////////
// //
// Main Function //
// //
//////////////////////////////////////////////////////////
void main()
{
if(FAILED(::CoInitialize(NULL)))
return;

ProcedureTextX();

::CoUninitialize();

//////////////////////////////////////////////////////////
// //
// ProcedureTextX Function //
// //
//////////////////////////////////////////////////////////
void ProcedureTextX()
{
HRESULT hr = S_OK;

// Define ADOX object pointers.
// Initialize pointers on define.
// These are in the ADOX:: namespace.
_CatalogPtr m_pCatalog = NULL;

// Define ADODB object pointers.
ADODB::_ConnectionPtr m_pCnn = NULL;
ADODB::_CommandPtr m_pCommand = NULL;

try
{
//Open the Connection
TESTHR(hr = m_pCnn.CreateInstance(__uuidof(ADODB::Connection)));
TESTHR(hr = m_pCatalog.CreateInstance(__uuidof(Catalog)));
TESTHR(hr = m_pCommand.CreateInstance(__uuidof(ADODB::Command)));
m_pCnn->Open("Provider=Microsoft.Jet.OLEDB.4.0;"
"data source=c:\\Program Files\\Microsoft Office"
"\\Office\\Samples\\Northwind.mdb;","","",NULL);

//Open the catalog
m_pCatalog->PutActiveConnection(_variant_t((IDispatch *)m_pCnn));

//Get the Command
m_pCommand = m_pCatalog->Procedures->GetItem("CustomerById")->GetCommand();

//Update the CommandText
m_pCommand->PutCommandText("PARAMETERS [CustId] Text;select "
"CustomerId, CompanyName, ContactName "
"from Customers where CustomerId = [CustId]");

//Update the Procedure
m_pCatalog->Procedures->GetItem("CustomerById")->PutCommand(
_variant_t((IDispatch *)m_pCommand));

catch(_com_error &e)
{
// Notify the user of errors if any.
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());

printf("\n\tSource : %s \n\tdescription : %s \n
",(LPCSTR)bstrSource,(LPCSTR)bstrDescription);

catch(...)
{
cout << "Error occured in include files...."<< endl;

Thanks in anticipation.

2. 19102-NY-ROCHESTER-Software Development-Visual Basic-Visual C++-MS ACCESS-ORACLE

3. Creating MSDE database using ADO/ADOX with VC++

4. Update with image

5. Oh~ I'm so sorry!!Please help me again.

6. Create any desktop database using ADOX/ADO

7. desc command in jdbc

8. Create any desktop database using ADO/ADOX

9. creating a new table in Oracle data base using ADOX

10. Select statement return error when creating a table using ADOX

11. In SQL Server select statement return error when creating table using ADOX

12. Create Tables using ADOX